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
This commit is contained in:
Cedric Brandily 2016-04-06 01:12:40 +02:00
parent e2e9c49cd9
commit b13ec98467
5 changed files with 11 additions and 11 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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},

View File

@ -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):