X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Ftests%2Ftest_admin_topics.py;h=a28953b5bcd211a43c933ca93eee5fa74e1047c0;hp=739b68c1360a92f1fb35016ecae897e5cfc3cdef;hb=2a929042e82cf1e010da9d8ff516f96159a57efd;hpb=79e40f41887cbc1e56f4b7c3518314952985fa51 diff --git a/osm_nbi/tests/test_admin_topics.py b/osm_nbi/tests/test_admin_topics.py index 739b68c..a28953b 100755 --- a/osm_nbi/tests/test_admin_topics.py +++ b/osm_nbi/tests/test_admin_topics.py @@ -50,7 +50,7 @@ class Test_ProjectTopicAuth(TestCase): self.db = Mock(dbbase.DbBase()) self.fs = Mock(fsbase.FsBase()) self.msg = Mock(msgbase.MsgBase()) - self.auth = Mock(authconn.Authconn(None, None, None)) + self.auth = Mock(authconn.Authconn(None, None)) self.topic = ProjectTopicAuth(self.db, self.fs, self.msg, self.auth) self.fake_session = {"username": self.test_name, "project_id": (test_pid,), "method": None, "admin": True, "force": False, "public": False, "allow_show_user_project_role": True} @@ -210,7 +210,7 @@ class Test_RoleTopicAuth(TestCase): self.db = Mock(dbbase.DbBase()) self.fs = Mock(fsbase.FsBase()) self.msg = Mock(msgbase.MsgBase()) - self.auth = Mock(authconn.Authconn(None, None, None)) + self.auth = Mock(authconn.Authconn(None, None)) self.topic = RoleTopicAuth(self.db, self.fs, self.msg, self.auth, self.test_operations) self.fake_session = {"username": test_name, "project_id": (test_pid,), "method": None, "admin": True, "force": False, "public": False, "allow_show_user_project_role": True} @@ -370,7 +370,7 @@ class Test_UserTopicAuth(TestCase): self.db = Mock(dbbase.DbBase()) self.fs = Mock(fsbase.FsBase()) self.msg = Mock(msgbase.MsgBase()) - self.auth = Mock(authconn.Authconn(None, None, None)) + self.auth = Mock(authconn.Authconn(None, None)) self.topic = UserTopicAuth(self.db, self.fs, self.msg, self.auth) self.fake_session = {"username": test_name, "project_id": (test_pid,), "method": None, "admin": True, "force": False, "public": False, "allow_show_user_project_role": True} @@ -588,7 +588,7 @@ class Test_CommonVimWimSdn(TestCase): self.db = Mock(dbbase.DbBase()) self.fs = Mock(fsbase.FsBase()) self.msg = Mock(msgbase.MsgBase()) - self.auth = Mock(authconn.Authconn(None, None, None)) + self.auth = Mock(authconn.Authconn(None, None)) self.topic = CommonVimWimSdn(self.db, self.fs, self.msg, self.auth) # Use WIM schemas for testing because they are the simplest self.topic.topic = "wims" @@ -631,16 +631,17 @@ class Test_CommonVimWimSdn(TestCase): "Wrong operation status enter time") self.assertEqual(operation["detailed-status"], "", "Wrong operation detailed status info") self.assertIsNone(operation["operationParams"], "Wrong operation parameters") - with self.subTest(i=2): - rollback = [] - test_type = "bad_type" - with self.assertRaises(EngineException, msg="Accepted wrong CIM type") as e: - self.topic.new(rollback, self.fake_session, - {"name": self.test_name, "wim_url": test_url, "wim_type": test_type}) - self.assertEqual(len(rollback), 0, "Wrong rollback length") - self.assertEqual(e.exception.http_code, HTTPStatus.UNPROCESSABLE_ENTITY, "Wrong HTTP status code") - self.assertIn("format error at '{}' '{}".format("wim_type", "'{}' is not one of {}").format(test_type, ""), - norm(str(e.exception)), "Wrong exception text") + # This test is disabled. From Feature 8030 we admit all WIM/SDN types + # with self.subTest(i=2): + # rollback = [] + # test_type = "bad_type" + # with self.assertRaises(EngineException, msg="Accepted wrong CIM type") as e: + # self.topic.new(rollback, self.fake_session, + # {"name": self.test_name, "wim_url": test_url, "wim_type": test_type}) + # self.assertEqual(len(rollback), 0, "Wrong rollback length") + # self.assertEqual(e.exception.http_code, HTTPStatus.UNPROCESSABLE_ENTITY, "Wrong HTTP status code") + # self.assertIn("format error at '{}' '{}".format("wim_type", "'{}' is not one of {}").format(test_type,""), + # norm(str(e.exception)), "Wrong exception text") def test_conflict_on_new(self): with self.subTest(i=1): @@ -715,6 +716,7 @@ class Test_CommonVimWimSdn(TestCase): ro_pid = str(uuid4()) rw_pid = str(uuid4()) cvws = {"_id": cid, "name": self.test_name} + self.db.get_list.return_value = [] with self.subTest(i=1): cvws["_admin"] = {"projects_read": [test_pid, ro_pid, rw_pid], "projects_write": [test_pid, rw_pid]} self.db.get_one.return_value = cvws @@ -728,7 +730,7 @@ class Test_CommonVimWimSdn(TestCase): "Wrong read-only projects update") self.assertEqual(self.db.set_one.call_args[1]["update_dict"]["_admin.projects_write"], [rw_pid], "Wrong read/write projects update") - with self.subTest(i=3): + with self.subTest(i=2): now = time() cvws["_admin"] = {"projects_read": [test_pid], "projects_write": [test_pid], "operations": []} self.db.get_one.return_value = cvws