diff options
author | Code Raguet <ignacio.code@gmail.com> | 2013-10-01 16:02:24 (GMT) |
---|---|---|
committer | Code Raguet <ignacio.code@gmail.com> | 2013-10-01 16:02:24 (GMT) |
commit | 36805e97008c21075145ff1932246ca4604181f1 (patch) | |
tree | 010975b3891931bb314fb3b857e31042a7c7b8b7 | |
parent | cd3ad0c93e79e4c513d814cf5360d600dafae11a (diff) |
add load_mongo_fixture function
-rw-r--r-- | webapp/webapp/features/terrain.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/webapp/webapp/features/terrain.py b/webapp/webapp/features/terrain.py index 69d392a..0ae8f58 100644 --- a/webapp/webapp/features/terrain.py +++ b/webapp/webapp/features/terrain.py @@ -38,6 +38,19 @@ def load_fixture(fixture_name): verbosity=0) +def load_mongo_fixture(fixture_name, collection): + POLLSTER_FIXTURES = os.path.join(settings.PROJECT_ROOT, + '../pollster/fixtures') + fixture_path = os.path.join(POLLSTER_FIXTURES, fixture_name + ".json") + kwargs = { + 'db': settings.MONGO_SETTINGS['NAME'], + 'collection': collection, + 'fixture': fixture_path, + } + cmd = "mongoimport -d {db} -c {collection} --file {fixture} --jsonArray" + local(cmd.format(**kwargs)) + + @before.each_feature def before_each_feature(feature): """This is the main lettuce hook "@before.each_feature".""" |