summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/compute/v2/test_aggregate.py
diff options
context:
space:
mode:
authorDirk Mueller <dirk@dmllr.de>2021-05-03 22:07:39 +0200
committerJavier Peña <jpena@redhat.com>2021-08-24 09:21:45 +0000
commit53f1efa010f9319ef939109d2ed5c4a852271d74 (patch)
tree29867b117854109a2fb60a0d8289b54bdbd29933 /openstackclient/tests/unit/compute/v2/test_aggregate.py
parentd50045e484df8f9662712bf1c2af3ec9bd3b2a2a (diff)
downloadpython-openstackclient-5.5.1.tar.gz
Replace assertItemsEqual with assertCountEqualwallaby-em5.5.1
assertItemsEqual was removed from Python's unittest.TestCase in Python 3.3 [1][2]. We have been able to use them since then, because testtools required unittest2, which still included it. With testtools removing Python 2.7 support [3][4], we will lose support for assertItemsEqual, so we should switch to use assertCountEqual. [1] - https://bugs.python.org/issue17866 [2] - https://hg.python.org/cpython/rev/d9921cb6e3cd [3] - testing-cabal/testtools#286 [4] - testing-cabal/testtools#277 Conflicts: openstackclient/tests/unit/volume/v2/test_volume_snapshot.py NOTE(jpena): This file is not present in stable/wallaby Change-Id: I0bbffbec8889b8b3067cfe17d258f5cb16624f38 (cherry picked from commit e82a05864f482acc485d1bd35a4db23452f8b2ac)
Diffstat (limited to 'openstackclient/tests/unit/compute/v2/test_aggregate.py')
-rw-r--r--openstackclient/tests/unit/compute/v2/test_aggregate.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/openstackclient/tests/unit/compute/v2/test_aggregate.py b/openstackclient/tests/unit/compute/v2/test_aggregate.py
index 8563f988..7c4fe5cb 100644
--- a/openstackclient/tests/unit/compute/v2/test_aggregate.py
+++ b/openstackclient/tests/unit/compute/v2/test_aggregate.py
@@ -88,7 +88,7 @@ class TestAggregateAddHost(TestAggregate):
self.sdk_client.add_host_to_aggregate.assert_called_once_with(
self.fake_ag.id, parsed_args.host)
self.assertEqual(self.columns, columns)
- self.assertItemsEqual(self.data, data)
+ self.assertCountEqual(self.data, data)
class TestAggregateCreate(TestAggregate):
@@ -112,7 +112,7 @@ class TestAggregateCreate(TestAggregate):
self.sdk_client.create_aggregate.assert_called_once_with(
name=parsed_args.name)
self.assertEqual(self.columns, columns)
- self.assertItemsEqual(self.data, data)
+ self.assertCountEqual(self.data, data)
def test_aggregate_create_with_zone(self):
arglist = [
@@ -129,7 +129,7 @@ class TestAggregateCreate(TestAggregate):
self.sdk_client.create_aggregate.assert_called_once_with(
name=parsed_args.name, availability_zone=parsed_args.zone)
self.assertEqual(self.columns, columns)
- self.assertItemsEqual(self.data, data)
+ self.assertCountEqual(self.data, data)
def test_aggregate_create_with_property(self):
arglist = [
@@ -148,7 +148,7 @@ class TestAggregateCreate(TestAggregate):
self.sdk_client.set_aggregate_metadata.assert_called_once_with(
self.fake_ag.id, parsed_args.properties)
self.assertEqual(self.columns, columns)
- self.assertItemsEqual(self.data, data)
+ self.assertCountEqual(self.data, data)
class TestAggregateDelete(TestAggregate):
@@ -265,7 +265,7 @@ class TestAggregateList(TestAggregate):
columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.list_columns, columns)
- self.assertItemsEqual(self.list_data, tuple(data))
+ self.assertCountEqual(self.list_data, tuple(data))
def test_aggregate_list_with_long(self):
arglist = [
@@ -278,7 +278,7 @@ class TestAggregateList(TestAggregate):
columns, data = self.cmd.take_action(parsed_args)
self.assertEqual(self.list_columns_long, columns)
- self.assertItemsEqual(self.list_data_long, tuple(data))
+ self.assertCountEqual(self.list_data_long, tuple(data))
class TestAggregateRemoveHost(TestAggregate):
@@ -306,7 +306,7 @@ class TestAggregateRemoveHost(TestAggregate):
self.sdk_client.remove_host_from_aggregate.assert_called_once_with(
self.fake_ag.id, parsed_args.host)
self.assertEqual(self.columns, columns)
- self.assertItemsEqual(self.data, data)
+ self.assertCountEqual(self.data, data)
class TestAggregateSet(TestAggregate):
@@ -492,7 +492,7 @@ class TestAggregateShow(TestAggregate):
parsed_args.aggregate, ignore_missing=False)
self.assertEqual(self.columns, columns)
- self.assertItemsEqual(self.data, tuple(data))
+ self.assertCountEqual(self.data, tuple(data))
class TestAggregateUnset(TestAggregate):