diff --git a/python/nistoar/midas/dbio/mongo.py b/python/nistoar/midas/dbio/mongo.py index 6793f17..4928794 100644 --- a/python/nistoar/midas/dbio/mongo.py +++ b/python/nistoar/midas/dbio/mongo.py @@ -11,7 +11,7 @@ from nistoar.base.config import ConfigurationException, merge_config -_dburl_re = re.compile(r"^mongodb://(\w+(:\S+)?@)?\w+(\.\w+)*(:\d+)?/\w+$") +_dburl_re = re.compile(r"^mongodb://(\w+(:\S+)?@)?\w+(\.\w+)*(:\d+)?/\w+(\?\w.*)?$") class MongoDBClient(base.DBClient): """ diff --git a/python/tests/nistoar/midas/dbio/test_mongo.py b/python/tests/nistoar/midas/dbio/test_mongo.py index 02d16f9..88331d6 100644 --- a/python/tests/nistoar/midas/dbio/test_mongo.py +++ b/python/tests/nistoar/midas/dbio/test_mongo.py @@ -72,7 +72,7 @@ def tearDown(self): client.get_database = client.get_default_database db = client.get_database() for coll in [base.GROUPS_COLL, base.PEOPLE_COLL, base.DMP_PROJECTS, base.DRAFT_PROJECTS, - "nextnum", "about", "action_log", "history"]: + "nextnum", "about", "prov_action_log", "history"]: if coll in db.list_collection_names(): db.drop_collection(coll) @@ -346,31 +346,25 @@ def test_select_records(self): self.assertEqual(recs[0].id, id) def test_action_log_io(self): - self.assertEqual(self.cli.native['action_log'].count_documents({}), 0) - self.cli._save_action_data( - {'subject': 'goob:gurn', 'foo': 'bar', 'timestamp': 8}) - acts = [r for r in self.cli.native['action_log'].find( - {}, {'_id': False})] + self.assertEqual(self.cli.native['prov_action_log'].count_documents({}), 0) + self.cli._save_action_data({'subject': 'goob:gurn', 'foo': 'bar', 'timestamp': 8}) + acts = [r for r in self.cli.native['prov_action_log'].find({}, {'_id': False})] self.assertEqual(len(acts), 1) self.assertEqual( acts[0], {'subject': 'goob:gurn', 'foo': 'bar', 'timestamp': 8}) - self.cli._save_action_data( - {'subject': 'goob:gurn', 'bob': 'alice', 'timestamp': 5}) - acts = [r for r in self.cli.native['action_log'].find( - {}, {'_id': False})] + self.cli._save_action_data({'subject': 'goob:gurn', 'bob': 'alice', 'timestamp': 5}) + acts = [r for r in self.cli.native['prov_action_log'].find({}, {'_id': False})] self.assertEqual(len(acts), 2) self.assertEqual( acts[0], {'subject': 'goob:gurn', 'foo': 'bar', 'timestamp': 8}) self.assertEqual( acts[1], {'subject': 'goob:gurn', 'bob': 'alice', 'timestamp': 5}) - self.assertEqual(self.cli.native['action_log'].count_documents( - {'subject': 'grp0001'}), 0) + self.assertEqual(self.cli.native['prov_action_log'].count_documents({'subject': 'grp0001'}), 0) self.cli._save_action_data({'subject': 'grp0001', 'dylan': 'bob'}) - self.assertEqual(self.cli.native['action_log'].count_documents({}), 3) - acts = [r for r in self.cli.native['action_log'].find( - {'subject': 'grp0001'}, {'_id': False})] + self.assertEqual(self.cli.native['prov_action_log'].count_documents({}), 3) + acts = [r for r in self.cli.native['prov_action_log'].find({'subject': 'grp0001'}, {'_id': False})] self.assertEqual(len(acts), 1) self.assertEqual(acts[0], {'subject': 'grp0001', 'dylan': 'bob'}) @@ -386,11 +380,10 @@ def test_action_log_io(self): self.assertEqual(acts[0], {'subject': 'grp0001', 'dylan': 'bob'}) self.cli._delete_actions_for("grp0001") - self.assertEqual(self.cli.native['action_log'].count_documents({}), 2) - self.assertEqual(self.cli.native['action_log'].count_documents( - {'subject': 'grp0001'}), 0) + self.assertEqual(self.cli.native['prov_action_log'].count_documents({}), 2) + self.assertEqual(self.cli.native['prov_action_log'].count_documents({'subject': 'grp0001'}), 0) self.cli._delete_actions_for("goob:gurn") - self.assertEqual(self.cli.native['action_log'].count_documents({}), 0) + self.assertEqual(self.cli.native['prov_action_log'].count_documents({}), 0) self.assertEqual(self.cli._select_actions_for("goob:gurn"), []) self.assertEqual(self.cli._select_actions_for("grp0001"), [])