Use the correct exception when checking for HTTP 406

Tempest has introduced NotAcceptable exception [1], breaking our usage of
UnexpectedResponseCode. Use the new exception.

[1] https://opendev.org/openstack/tempest/commit/e60b31706240d989ba6d0244acbbb97154c47a13

Change-Id: I1e07e09348613493572d6aa55a2a3cde686497ed
diff --git a/ironic_tempest_plugin/tests/api/admin/test_nodes.py b/ironic_tempest_plugin/tests/api/admin/test_nodes.py
index 6d63768..3da3f3e 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_nodes.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_nodes.py
@@ -372,7 +372,7 @@
     def test_create_node_resource_class_old_api(self):
         """Try to create a node with resource class using older api version."""
         resource_class = data_utils.arbitrary_string()
-        self.assertRaises(lib_exc.UnexpectedResponseCode, self.create_node,
+        self.assertRaises(lib_exc.NotAcceptable, self.create_node,
                           self.chassis['uuid'], resource_class=resource_class)
 
     @decorators.attr(type='negative')
@@ -380,7 +380,7 @@
     def test_update_node_resource_class_old_api(self):
         """Try to update a node with resource class using older api version."""
         resource_class = data_utils.arbitrary_string()
-        self.assertRaises(lib_exc.UnexpectedResponseCode,
+        self.assertRaises(lib_exc.NotAcceptable,
                           self.client.update_node,
                           self.node['uuid'], resource_class=resource_class)
 
@@ -390,10 +390,10 @@
         """Try to list nodes with resource class using older api version."""
         resource_class = data_utils.arbitrary_string()
         self.assertRaises(
-            lib_exc.UnexpectedResponseCode,
+            lib_exc.NotAcceptable,
             self.client.list_nodes, resource_class=resource_class)
         self.assertRaises(
-            lib_exc.UnexpectedResponseCode,
+            lib_exc.NotAcceptable,
             self.client.list_nodes_detail, resource_class=resource_class)
 
 
@@ -1043,10 +1043,9 @@
     @decorators.idempotent_id('5419af7b-4e27-4be4-88f6-e01c598a8102')
     def test_list_node_traits_old_api(self):
         """Try to list traits for a node using an older api version."""
-        exc = self.assertRaises(
-            lib_exc.UnexpectedResponseCode,
+        self.assertRaises(
+            lib_exc.NotAcceptable,
             self.client.list_node_traits, self.node['uuid'])
-        self.assertEqual(406, exc.resp.status)
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('a4353f3a-bedc-4579-9c7e-4bebcd95903d')
@@ -1096,10 +1095,9 @@
     @decorators.idempotent_id('eb75b3c8-ac9c-4399-90a2-c0030bfde7a6')
     def test_list_nodes_traits_field(self):
         """Try to list nodes' traits field using older api version."""
-        exc = self.assertRaises(
-            lib_exc.UnexpectedResponseCode,
+        self.assertRaises(
+            lib_exc.NotAcceptable,
             self.client.list_nodes, fields='traits')
-        self.assertEqual(406, exc.resp.status)
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('214ae7fc-149b-4657-b6bc-66353d49ade8')
diff --git a/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py b/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py
index bd338f9..8a812a6 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py
@@ -354,7 +354,7 @@
         node_id = self.node['uuid']
         address = data_utils.rand_mac_address()
 
-        self.assertRaises((lib_exc.BadRequest, lib_exc.UnexpectedResponseCode),
+        self.assertRaises((lib_exc.BadRequest, lib_exc.NotAcceptable),
                           self.create_port,
                           node_id=node_id, address=address,
                           physical_network='physnet1')
@@ -371,7 +371,7 @@
                   'op': 'replace',
                   'value': new_physnet}]
 
-        self.assertRaises((lib_exc.BadRequest, lib_exc.UnexpectedResponseCode),
+        self.assertRaises((lib_exc.BadRequest, lib_exc.NotAcceptable),
                           self.client.update_port,
                           port['uuid'], patch)