Add a hacking check to block scenario manager in api tests
This commit adds a new hacking check to ensure that the manager class
from the scenario tests, OfficialClientManager, isn't used in the API
tests. There is already a hacking rule preventing imports of the
official clients, T102. But, the official clients could still be used
through the scenario tests which wouldn't be caught by T102. This
attempts to close that gap by adding a new hacking check for
OfficialClientManager.
Change-Id: I608a1319c136118947e3df74fa88f7124011caa4
diff --git a/tempest/tests/test_hacking.py b/tempest/tests/test_hacking.py
index ab81836..70bfdb7 100644
--- a/tempest/tests/test_hacking.py
+++ b/tempest/tests/test_hacking.py
@@ -93,3 +93,11 @@
'./tempest/scenario/compute/fake_test.py'))
self.assertFalse(checks.service_tags_not_in_module_path(
"@test.services('compute')", './tempest/api/image/fake_test.py'))
+
+ def test_no_official_client_manager_in_api_tests(self):
+ self.assertTrue(checks.no_official_client_manager_in_api_tests(
+ "cls.official_client = clients.OfficialClientManager(credentials)",
+ "tempest/api/compute/base.py"))
+ self.assertFalse(checks.no_official_client_manager_in_api_tests(
+ "cls.official_client = clients.OfficialClientManager(credentials)",
+ "tempest/scenario/fake_test.py"))