summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Mueller <dirk@dmllr.de>2020-06-11 11:40:40 +0200
committerDirk Mueller <dirk@dmllr.de>2020-06-11 11:45:18 +0200
commit441ac7c0bf74fef94678e91ae577894ca66693c8 (patch)
treeacd4ee1df12948435da8e81d7ae733e4d9102847
parentdf7dbabb7dd63bc8066d9cc89955a510bf63b04d (diff)
downloadpython-barbicanclient-441ac7c0bf74fef94678e91ae577894ca66693c8.tar.gz
Switch from unittest2 compat methods to Python 3.x methods
With the removal of Python 2.x we can remove the unittest2 compat wrappers and switch to assertCountEqual instead of assertItemsEqual 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^ Change-Id: I5e02a7ed7803e21ad2baa93fccd00a23cda3da79
-rw-r--r--barbicanclient/tests/v1/test_containers.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/barbicanclient/tests/v1/test_containers.py b/barbicanclient/tests/v1/test_containers.py
index 67eaa26..3cbdd92 100644
--- a/barbicanclient/tests/v1/test_containers.py
+++ b/barbicanclient/tests/v1/test_containers.py
@@ -200,7 +200,7 @@ class WhenTestingContainers(test_client.BaseEntityResource):
container_req = jsonutils.loads(self.responses.last_request.text)
self.assertEqual(self.container.name, container_req['name'])
self.assertEqual('certificate', container_req['type'])
- self.assertItemsEqual(self.container.certificate_secret_refs_json,
+ self.assertCountEqual(self.container.certificate_secret_refs_json,
container_req['secret_refs'])
def test_should_store_certificate_via_constructor(self):
@@ -225,7 +225,7 @@ class WhenTestingContainers(test_client.BaseEntityResource):
container_req = jsonutils.loads(self.responses.last_request.text)
self.assertEqual(self.container.name, container_req['name'])
self.assertEqual('certificate', container_req['type'])
- self.assertItemsEqual(self.container.certificate_secret_refs_json,
+ self.assertCountEqual(self.container.certificate_secret_refs_json,
container_req['secret_refs'])
def test_should_store_rsa_via_attributes(self):
@@ -249,7 +249,7 @@ class WhenTestingContainers(test_client.BaseEntityResource):
container_req = jsonutils.loads(self.responses.last_request.text)
self.assertEqual(self.container.name, container_req['name'])
self.assertEqual('rsa', container_req['type'])
- self.assertItemsEqual(self.container.rsa_secret_refs_json,
+ self.assertCountEqual(self.container.rsa_secret_refs_json,
container_req['secret_refs'])
def test_should_store_rsa_via_constructor(self):
@@ -274,7 +274,7 @@ class WhenTestingContainers(test_client.BaseEntityResource):
container_req = jsonutils.loads(self.responses.last_request.text)
self.assertEqual(self.container.name, container_req['name'])
self.assertEqual('rsa', container_req['type'])
- self.assertItemsEqual(self.container.rsa_secret_refs_json,
+ self.assertCountEqual(self.container.rsa_secret_refs_json,
container_req['secret_refs'])
def test_should_get_secret_refs_when_created_using_secret_objects(self):