From ad1e85f86786c01a6faffa1883301dc16db80d3c Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Fri, 8 Nov 2019 16:30:43 +0200 Subject: [PATCH] Fixed typo and added some documentation. --- .travis.yml | 2 +- monkey/monkey_island/cc/environment/testing.py | 4 ++++ monkey/monkey_island/cc/models/__init__.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d637c54ee..d6148ec39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/monkey/monkey_island/cc/environment/testing.py b/monkey/monkey_island/cc/environment/testing.py index 087c3a2e3..4f65d1710 100644 --- a/monkey/monkey_island/cc/environment/testing.py +++ b/monkey/monkey_island/cc/environment/testing.py @@ -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 diff --git a/monkey/monkey_island/cc/models/__init__.py b/monkey/monkey_island/cc/models/__init__.py index d8c1b05c8..94d56d6a8 100644 --- a/monkey/monkey_island/cc/models/__init__.py +++ b/monkey/monkey_island/cc/models/__init__.py @@ -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)