Merge "Remove ordering attempts of 'unorderable types'"

This commit is contained in:
Zuul 2018-04-25 12:13:45 +00:00 committed by Gerrit Code Review
commit 9b218b45ad
3 changed files with 18 additions and 7 deletions

View File

@ -161,8 +161,11 @@ class ShareAccessDatabaseAPITestCase(test.TestCase):
share_access_keys_present = True if with_share_access_data else False
actual_access_ids = [r['access_id'] for r in rules]
self.assertEqual(sorted([access_1['id'], access_2['id']]),
sorted(actual_access_ids))
self.assertTrue(isinstance(actual_access_ids, list))
expected = [access_1['id'], access_2['id']]
self.assertEqual(len(expected), len(actual_access_ids))
for pool in expected:
self.assertIn(pool, actual_access_ids)
for rule in rules:
for key in share_access_keys:
self.assertEqual(share_access_keys_present, key in rule)

View File

@ -589,8 +589,10 @@ class HostManagerTestCase(test.TestCase):
},
},
]
self.assertTrue(isinstance(res, list))
self.assertEqual(len(expected), len(res))
self.assertEqual(sorted(expected), sorted(res))
for pool in expected:
self.assertIn(pool, res)
@ddt.data(
None,

View File

@ -454,8 +454,11 @@ class ShareInstanceAccessTestCase(test.TestCase):
# Asserts
self.assertIsNone(retval)
self.assertEqual(share_instance_id, call_args[1]['id'])
self.assertEqual(sorted(expected_rules_to_be_on_share),
sorted(access_rules_to_be_on_share))
self.assertTrue(isinstance(access_rules_to_be_on_share, list))
self.assertEqual(len(expected_rules_to_be_on_share),
len(access_rules_to_be_on_share))
for pool in expected_rules_to_be_on_share:
self.assertIn(pool, access_rules_to_be_on_share)
self.assertEqual(1, len(call_kwargs['add_rules']))
self.assertEqual(rule_2['id'], call_kwargs['add_rules'][0]['id'])
self.assertEqual(1, len(call_kwargs['delete_rules']))
@ -659,8 +662,11 @@ class ShareInstanceAccessTestCase(test.TestCase):
self.assertIsNone(retval)
self.assertEqual(instance['id'], call_args[1]['id'])
self.assertEqual(sorted(expected_rules_to_be_on_share),
sorted(access_rules_to_be_on_share))
self.assertTrue(isinstance(access_rules_to_be_on_share, list))
self.assertEqual(len(expected_rules_to_be_on_share),
len(access_rules_to_be_on_share))
for pool in expected_rules_to_be_on_share:
self.assertIn(pool, access_rules_to_be_on_share)
self.assertEqual(['ro'] * len(expected_rules_to_be_on_share),
access_levels)
self.assertEqual(0, len(call_kwargs['add_rules']))