+ with self.subTest(i=5, t='No delete because referenced by other project'):
+ db_vnfd_content["_admin"]["projects_read"].append("other_project")
+ self.db.get_one = Mock(return_value=db_vnfd_content)
+ self.db.get_list = Mock(return_value=[])
+ self.msg.write.reset_mock()
+ self.db.del_one.reset_mock()
+ self.fs.file_delete.reset_mock()
+
+ self.topic.delete(fake_session, did)
+ self.db.del_one.assert_not_called()
+ self.msg.write.assert_not_called()
+ db_g1_args = self.db.get_one.call_args[0]
+ self.assertEqual(db_g1_args[0], self.topic.topic, "Wrong DB topic")
+ self.assertEqual(db_g1_args[1]["_id"], did, "Wrong DB VNFD ID")
+ db_s1_args = self.db.set_one.call_args
+ self.assertEqual(db_s1_args[0][0], self.topic.topic, "Wrong DB topic")
+ self.assertEqual(db_s1_args[0][1]["_id"], did, "Wrong DB ID")
+ self.assertIn(p_id, db_s1_args[0][1]["_admin.projects_write.cont"], "Wrong DB filter")
+ self.assertIsNone(db_s1_args[1]["update_dict"], "Wrong DB update dictionary")
+ self.assertIn("_admin.projects_read." + p_id, db_s1_args[1]["pull"], "Wrong DB pull dictionary")
+ self.assertIn("_admin.projects_write." + p_id, db_s1_args[1]["pull"], "Wrong DB pull dictionary")
+ self.fs.file_delete.assert_not_called()