forked from p15670423/monkey
Fixed typo and added some documentation.
This commit is contained in:
parent
0acec95c86
commit
ad1e85f867
|
@ -18,7 +18,7 @@ install:
|
|||
- pip install -r monkey/infection_monkey/requirements_linux.txt # for unit tests
|
||||
|
||||
before_script:
|
||||
# Set the server config to `testing`, for the UTs to use mongomaock and pass.
|
||||
# Set the server config to `testing`. This is required for for the UTs to pass.
|
||||
- python monkey/monkey_island/cc/set_server_config.py testing
|
||||
|
||||
script:
|
||||
|
|
|
@ -2,6 +2,10 @@ from monkey_island.cc.environment import Environment
|
|||
|
||||
|
||||
class TestingEnvironment(Environment):
|
||||
"""
|
||||
Use this environment for running Unit Tests.
|
||||
This will cause all mongo connections to happen via `mongomock` instead of using an actual mongodb instance.
|
||||
"""
|
||||
def __init__(self):
|
||||
super(TestingEnvironment, self).__init__()
|
||||
self.testing = True
|
||||
|
|
|
@ -6,7 +6,7 @@ from monkey_island.cc.environment.environment import env
|
|||
# If testing, use mongomock which only emulates mongo. for more information, see
|
||||
# http://docs.mongoengine.org/guide/mongomock.html .
|
||||
# Otherwise, use an actual mongod instance with connection parameters supplied by env.
|
||||
if env.testing:
|
||||
if env.testing: # See monkey_island.cc.environment.testing
|
||||
connect('mongoenginetest', host='mongomock://localhost')
|
||||
else:
|
||||
connect(db=env.mongo_db_name, host=env.mongo_db_host, port=env.mongo_db_port)
|
||||
|
|
Loading…
Reference in New Issue