File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,8 @@ def env_setup(monkeypatch):
88 monkeypatch .setenv ('AWS_SECRET_ACCESS_KEY' , 'password' )
99 monkeypatch .setenv ('NODE_ENV' , 'production' )
1010 monkeypatch .setenv ('S3_URL' , 'http://localhost:9000' )
11- monkeypatch .setenv ('REDIS_HOST ' , 'localhost' )
11+ monkeypatch .setenv ('REDIS_URL ' , 'redis:// localhost:6379/0 ' )
1212 monkeypatch .setenv ('S3_BUCKET' , 'alfalfa' )
1313 monkeypatch .setenv ('JOB_QUEUE' , 'Alfalfa Job Queue' )
14- monkeypatch .setenv ('MONGO_URL' , 'mongodb://localhost:27017' )
15- monkeypatch .setenv ('MONGO_DB_NAME' , 'alfalfa_test' )
16- monkeypatch .setenv ('REGION' , 'us-west-1' )
14+ monkeypatch .setenv ('MONGO_URL' , 'mongodb://admin:password@localhost:27017/alfalfa_test?authSource=admin' )
15+ monkeypatch .setenv ('S3_REGION' , 'us-west-1' )
Original file line number Diff line number Diff line change 55import random
66import time
77
8- from mongoengine import connect
8+ from mongoengine import connect , disconnect_all
99
1010# use the mongo test config file
1111from alfalfa_worker .lib .models import Rec , Run , Site
@@ -16,7 +16,8 @@ class TestModelsObjects:
1616 def setup_method (self ):
1717 """Create the connection to the mongodatabase since we are not loading the entire framework.
1818 Note that the config params are monkeypatched in the conftest file"""
19- connect (host = f"{ os .environ ['MONGO_URL' ]} /{ os .environ ['MONGO_DB_NAME' ]} " , uuidrepresentation = 'standard' )
19+ disconnect_all ()
20+ connect (host = f"{ os .environ ['MONGO_URL' ]} " , uuidrepresentation = 'standard' )
2021
2122 def test_create_and_destroy_site (self ):
2223 id_value = str (random .randint (0 , 1024 ))
@@ -42,7 +43,8 @@ class TestModelObjectsWithFixtures():
4243 def setup_method (self ):
4344 """Create the connection to the mongodatabase since we are not loading the entire framework.
4445 Note that the config params are monkeypatched in the conftest file"""
45- connect (host = f"{ os .environ ['MONGO_URL' ]} /{ os .environ ['MONGO_DB_NAME' ]} " , uuidrepresentation = 'standard' )
46+ disconnect_all ()
47+ connect (host = f"{ os .environ ['MONGO_URL' ]} " , uuidrepresentation = 'standard' )
4648
4749 for datum in site_data :
4850 site = Site (** datum )
You can’t perform that action at this time.
0 commit comments