diff options
| author | Cedric Brandily <zzelle@gmail.com> | 2016-04-06 01:12:40 +0200 |
|---|---|---|
| committer | Cedric Brandily <zzelle@gmail.com> | 2016-04-06 20:59:59 +0200 |
| commit | b13ec98467f2d374e741efa5888937c5f2b86ebb (patch) | |
| tree | dd88c7eb6c78623bb1045dbe7c606744a7b9b40a /functional | |
| parent | e2e9c49cd920947eec1f873e74a98ec5ab6834fd (diff) | |
| download | python-openstackclient-b13ec98467f2d374e741efa5888937c5f2b86ebb.tar.gz | |
Prefer assertEqual/assertIn over assertOutput/assertInOutput
functional.common.tests module defines:
* assertOutput (similar to assertEqual)
* assertInOutput (similar to assertIn)
in order to allow the usage of assertions in testcase classmethods but
there is no reason to use them in testcase instancemethods at least
because they raise Exception instances instead of AssertionError
instances.
Change-Id: I9ffcaf9c6e6a1ff5df6ea2d79be3fb4496db4b85
Diffstat (limited to 'functional')
| -rw-r--r-- | functional/tests/common/test_quota.py | 2 | ||||
| -rw-r--r-- | functional/tests/identity/v2/test_endpoint.py | 2 | ||||
| -rw-r--r-- | functional/tests/identity/v3/test_endpoint.py | 2 | ||||
| -rw-r--r-- | functional/tests/identity/v3/test_group.py | 14 | ||||
| -rw-r--r-- | functional/tests/identity/v3/test_project.py | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/functional/tests/common/test_quota.py b/functional/tests/common/test_quota.py index 7a0cb640..62b43a34 100644 --- a/functional/tests/common/test_quota.py +++ b/functional/tests/common/test_quota.py @@ -35,4 +35,4 @@ class QuotaTests(test.TestCase): def test_quota_show(self): raw_output = self.openstack('quota show ' + self.PROJECT_NAME) for expected_field in self.EXPECTED_FIELDS: - self.assertInOutput(expected_field, raw_output) + self.assertIn(expected_field, raw_output) diff --git a/functional/tests/identity/v2/test_endpoint.py b/functional/tests/identity/v2/test_endpoint.py index 0aed3220..8064365e 100644 --- a/functional/tests/identity/v2/test_endpoint.py +++ b/functional/tests/identity/v2/test_endpoint.py @@ -27,7 +27,7 @@ class EndpointTests(test_identity.IdentityTests): def test_endpoint_list(self): endpoint_id = self._create_dummy_endpoint() raw_output = self.openstack('endpoint list') - self.assertInOutput(endpoint_id, raw_output) + self.assertIn(endpoint_id, raw_output) items = self.parse_listing(raw_output) self.assert_table_structure(items, self.ENDPOINT_LIST_HEADERS) diff --git a/functional/tests/identity/v3/test_endpoint.py b/functional/tests/identity/v3/test_endpoint.py index a7590787..e68aa848 100644 --- a/functional/tests/identity/v3/test_endpoint.py +++ b/functional/tests/identity/v3/test_endpoint.py @@ -31,7 +31,7 @@ class EndpointTests(test_identity.IdentityTests): def test_endpoint_list(self): endpoint_id = self._create_dummy_endpoint() raw_output = self.openstack('endpoint list') - self.assertInOutput(endpoint_id, raw_output) + self.assertIn(endpoint_id, raw_output) items = self.parse_listing(raw_output) self.assert_table_structure(items, self.ENDPOINT_LIST_HEADERS) diff --git a/functional/tests/identity/v3/test_group.py b/functional/tests/identity/v3/test_group.py index 4c6ed19b..156a9ff1 100644 --- a/functional/tests/identity/v3/test_group.py +++ b/functional/tests/identity/v3/test_group.py @@ -25,7 +25,7 @@ class GroupTests(test_identity.IdentityTests): raw_output = self.openstack('group list') items = self.parse_listing(raw_output) self.assert_table_structure(items, test_identity.BASIC_LIST_HEADERS) - self.assertInOutput(group_name, raw_output) + self.assertIn(group_name, raw_output) def test_group_list_with_domain(self): group_name = self._create_dummy_group() @@ -33,7 +33,7 @@ class GroupTests(test_identity.IdentityTests): 'group list --domain %s' % self.domain_name) items = self.parse_listing(raw_output) self.assert_table_structure(items, test_identity.BASIC_LIST_HEADERS) - self.assertInOutput(group_name, raw_output) + self.assertIn(group_name, raw_output) def test_group_delete(self): group_name = self._create_dummy_group(add_clean_up=False) @@ -102,7 +102,7 @@ class GroupTests(test_identity.IdentityTests): 'user_domain': self.domain_name, 'group': group_name, 'user': username}) - self.assertOutput( + self.assertEqual( '%(user)s added to group %(group)s\n' % {'user': username, 'group': group_name}, raw_output @@ -128,7 +128,7 @@ class GroupTests(test_identity.IdentityTests): 'user_domain': self.domain_name, 'group': group_name, 'user': username}) - self.assertOutput( + self.assertEqual( '%(user)s added to group %(group)s\n' % {'user': username, 'group': group_name}, raw_output @@ -141,7 +141,7 @@ class GroupTests(test_identity.IdentityTests): 'user_domain': self.domain_name, 'group': group_name, 'user': username}) - self.assertOutput( + self.assertEqual( '%(user)s in group %(group)s\n' % {'user': username, 'group': group_name}, raw_output) @@ -165,12 +165,12 @@ class GroupTests(test_identity.IdentityTests): 'user_domain': self.domain_name, 'group': group_name, 'user': username}) - self.assertOutput( + self.assertEqual( '%(user)s added to group %(group)s\n' % {'user': username, 'group': group_name}, add_raw_output ) - self.assertOutput( + self.assertEqual( '%(user)s removed from ' 'group %(group)s\n' % {'user': username, 'group': group_name}, diff --git a/functional/tests/identity/v3/test_project.py b/functional/tests/identity/v3/test_project.py index 204a8d14..6c278691 100644 --- a/functional/tests/identity/v3/test_project.py +++ b/functional/tests/identity/v3/test_project.py @@ -65,7 +65,7 @@ class ProjectTests(test_identity.IdentityTests): 'project list --domain %s' % self.domain_name) items = self.parse_listing(raw_output) self.assert_table_structure(items, test_identity.BASIC_LIST_HEADERS) - self.assertInOutput(project_name, raw_output) + self.assertIn(project_name, raw_output) self.assertTrue(len(items) > 0) def test_project_set(self): |
