-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test frameowrk to test framework (to test framework...)
- Loading branch information
Showing
8 changed files
with
82 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[LOGGING] | ||
log_level = INFO | ||
log_path = logs | ||
log_freq = midnight | ||
log_total = 30 | ||
discord_webhook = #SECRET | ||
discord_level = ERROR | ||
slack_webhook = #SECRET | ||
slack_level = ERROR | ||
hipchat_webhook = #SECRET | ||
hipchat_level = ERROR | ||
|
||
[MONGO] | ||
username = #SECRET | ||
password = #SECRET | ||
connection_string = #SECRET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"""exceptions for test_utils cases""" | ||
class TestUtilsException(Exception): | ||
"""general exception for prosper.test_utils modules""" | ||
pass | ||
|
||
class DockerUtilsException(TestUtilsException): | ||
"""general exception for docker_utils libraries""" | ||
pass | ||
|
||
class DockerNotFound(DockerUtilsException): | ||
"""cannot find/connect to Docker in environment""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""common test stuff""" | ||
|
||
import os | ||
|
||
import prosper.common.prosper_config as p_config | ||
|
||
HERE = os.path.abspath(os.path.dirname(__file__)) | ||
ROOT = os.path.join( | ||
os.path.dirname(HERE), 'prosper', 'test_utils' | ||
) | ||
|
||
TEST_CONFIG = p_config.ProsperConfig(os.path.join(HERE, 'test.cfg')) | ||
ROOT_CONFIG = p_config.ProsperConfig(os.path.join(ROOT, 'app.cfg')) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""validate prosper.test_utils.schema_utils""" | ||
import os | ||
|
||
import pytest | ||
import helpers | ||
|
||
import prosper.test_utils.schema_utils as schema_utils | ||
|
||
class TestMongoContextManager: | ||
"""validate expected behavior for MongoContextManager""" | ||
database_name = 'mongo_test' | ||
demo_data = [ | ||
{'butts': True, 'many': 10}, | ||
{'butts': False, 'many': 100}, | ||
] | ||
def test_mongo_context_testmode(self, tmpdir): | ||
"""test with _testmode enabled""" | ||
mongo_context = schema_utils.MongoContextManager( | ||
helpers.TEST_CONFIG, | ||
self.database_name, | ||
) | ||
mongo_context._testmode = True | ||
mongo_context._testmode_filepath = tmpdir | ||
with mongo_context as _: | ||
_['test_collection'].insert(self.demo_data) | ||
|
||
with mongo_context as _: | ||
data = _['test_collection'].find_one({'butts': True}) | ||
|
||
assert data['many'] == 10 |