-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Instead of manually adding each model used in tests in the tests/init.py file, drop collections from config list.
eg.
class BaseTestCase(TestCase):
...
def tearDown(self):
self.__teardown_models()
def __teardown_models(self):
for model in config.MODELS:
module = importlib.import_module(
'app.models.{0}'.format(model)
)
try:
getattr(module, to_camel_case(model)).drop_collection()
except AttributeError: # EmbeddedDocuments don't have drop_collection
pass
def to_camel_case(snake):
return ''.join([x.title() for x in snake.split('_')])
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels