X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Ftests%2Ftest_instance_topics.py;h=9dc5cc16fd3b25caa588f028d6a61ccd28707ba6;hb=5347198c2591ffe017f8f0561594441523ee7450;hp=6d82b0fe6362807348872b84eeb102b70841a3f5;hpb=f5f2e3f9cecc38647a437af7812323a1da7d3f60;p=osm%2FNBI.git diff --git a/osm_nbi/tests/test_instance_topics.py b/osm_nbi/tests/test_instance_topics.py index 6d82b0f..9dc5cc1 100644 --- a/osm_nbi/tests/test_instance_topics.py +++ b/osm_nbi/tests/test_instance_topics.py @@ -250,11 +250,13 @@ class TestNsrTopic(unittest.TestCase): self.db.set_one = Mock() self.nsr_topic.delete(session, self.nsr_id) - db_args = self.db.del_one.call_args[0] + db_args_ro_nsrs = self.db.del_one.call_args_list[1][0] + db_args = self.db.del_one.call_args_list[0][0] msg_args = self.msg.write.call_args[0] self.assertEqual(msg_args[0], self.nsr_topic.topic_msg, "Wrong message topic") self.assertEqual(msg_args[1], "deleted", "Wrong message action") self.assertEqual(msg_args[2], {"_id": self.nsr_id}, "Wrong message content") + self.assertEqual(db_args_ro_nsrs[0], "ro_nsrs", "Wrong DB topic") self.assertEqual(db_args[0], self.nsr_topic.topic, "Wrong DB topic") self.assertEqual(db_args[1]["_id"], self.nsr_id, "Wrong DB ID") self.assertEqual(db_args[1]["_admin.projects_read.cont"], [p_id], "Wrong DB filter") @@ -276,8 +278,9 @@ class TestNsrTopic(unittest.TestCase): self.assertEqual(db_s1_args[0][0], self.nsr_topic.topic, "Wrong DB topic") self.assertEqual(db_s1_args[0][1]["_id"], self.nsr_id, "Wrong DB ID") self.assertIsNone(db_s1_args[1]["update_dict"], "Wrong DB update dictionary") - self.assertIn("_admin.projects_read." + p_other, db_s1_args[1]["pull"], "Wrong DB pull dictionary") - self.assertIn("_admin.projects_write." + p_other, db_s1_args[1]["pull"], "Wrong DB pull dictionary") + self.assertEqual(db_s1_args[1]["pull_list"], + {"_admin.projects_read": [p_other], "_admin.projects_write": [p_other]}, + "Wrong DB pull_list dictionary") self.fs.file_delete.assert_not_called() with self.subTest(i=4, t='Delete with force and admin'): self.db.del_one.reset_mock() @@ -286,11 +289,13 @@ class TestNsrTopic(unittest.TestCase): self.fs.file_delete.reset_mock() self.nsr_topic.delete(session_force, self.nsr_id) - db_args = self.db.del_one.call_args[0] + db_args_ro_nsrs = self.db.del_one.call_args_list[1][0] + db_args = self.db.del_one.call_args_list[0][0] msg_args = self.msg.write.call_args[0] self.assertEqual(msg_args[0], self.nsr_topic.topic_msg, "Wrong message topic") self.assertEqual(msg_args[1], "deleted", "Wrong message action") self.assertEqual(msg_args[2], {"_id": self.nsr_id}, "Wrong message content") + self.assertEqual(db_args_ro_nsrs[0], "ro_nsrs", "Wrong DB topic") self.assertEqual(db_args[0], self.nsr_topic.topic, "Wrong DB topic") self.assertEqual(db_args[1]["_id"], self.nsr_id, "Wrong DB ID") self.db.set_one.assert_not_called()