Deduplicate _assertExpected method in tests
Deduplicate _assertExpected method in baremetal admin api tests.
Change-Id: Icba38b77529c78895d713a7ee7bf19193a8141cf
diff --git a/ironic_tempest_plugin/tests/api/admin/base.py b/ironic_tempest_plugin/tests/api/admin/base.py
index cc3636b..0e3f59e 100644
--- a/ironic_tempest_plugin/tests/api/admin/base.py
+++ b/ironic_tempest_plugin/tests/api/admin/base.py
@@ -118,6 +118,13 @@
finally:
super(BaseBaremetalTest, cls).resource_cleanup()
+ def _assertExpected(self, expected, actual):
+ """Check if not expected keys/values exist in actual response body."""
+ for key, value in expected.items():
+ if key not in ('created_at', 'updated_at'):
+ self.assertIn(key, actual)
+ self.assertEqual(value, actual[key])
+
def setUp(self):
super(BaseBaremetalTest, self).setUp()
self.useFixture(api_microversion_fixture.APIMicroversionFixture(
diff --git a/ironic_tempest_plugin/tests/api/admin/test_chassis.py b/ironic_tempest_plugin/tests/api/admin/test_chassis.py
index 52109e0..78912a2 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_chassis.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_chassis.py
@@ -26,13 +26,6 @@
super(TestChassis, cls).resource_setup()
_, cls.chassis = cls.create_chassis()
- def _assertExpected(self, expected, actual):
- # Check if not expected keys/values exists in actual response body
- for key, value in expected.items():
- if key not in ('created_at', 'updated_at'):
- self.assertIn(key, actual)
- self.assertEqual(value, actual[key])
-
@decorators.idempotent_id('7c5a2e09-699c-44be-89ed-2bc189992d42')
def test_create_chassis(self):
descr = data_utils.rand_name('test-chassis')
diff --git a/ironic_tempest_plugin/tests/api/admin/test_nodes.py b/ironic_tempest_plugin/tests/api/admin/test_nodes.py
index 8f1b0da..4112698 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_nodes.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_nodes.py
@@ -29,13 +29,6 @@
_, self.chassis = self.create_chassis()
_, self.node = self.create_node(self.chassis['uuid'])
- def _assertExpected(self, expected, actual):
- # Check if not expected keys/values exists in actual response body
- for key, value in expected.items():
- if key not in ('created_at', 'updated_at'):
- self.assertIn(key, actual)
- self.assertEqual(value, actual[key])
-
def _associate_node_with_instance(self):
self.client.set_node_power_state(self.node['uuid'], 'power off')
waiters.wait_for_bm_node_status(self.client, self.node['uuid'],
diff --git a/ironic_tempest_plugin/tests/api/admin/test_ports.py b/ironic_tempest_plugin/tests/api/admin/test_ports.py
index ed2e911..fe10573 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_ports.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_ports.py
@@ -28,13 +28,6 @@
_, self.port = self.create_port(self.node['uuid'],
data_utils.rand_mac_address())
- def _assertExpected(self, expected, actual):
- # Check if not expected keys/values exists in actual response body
- for key, value in expected.items():
- if key not in ('created_at', 'updated_at'):
- self.assertIn(key, actual)
- self.assertEqual(value, actual[key])
-
@decorators.idempotent_id('83975898-2e50-42ed-b5f0-e510e36a0b56')
def test_create_port(self):
node_id = self.node['uuid']