Make checking for singular SPs in list instead of list equality

There is a race condition when the test_service_providers_in_token
test is run at the same time as the k2k test because an extra SP
will appear in the list.

By checking items in the list individually instead of comparing
list equality this should fix the issue.

Change-Id: I13a7a747e108562b326aee1b88485a377530f8a5
This commit is contained in:
Kristi Nikolla 2020-04-07 11:52:09 -04:00
parent 47244edbc5
commit c393015d2d
1 changed files with 7 additions and 2 deletions

View File

@ -194,13 +194,18 @@ class ServiceProvidersTest(base.BaseIdentityTest):
enabled_sps.append(sp_id)
# Create some disabled service providers
disabled_sps = []
for _ in range(2):
sp_id = data_utils.rand_uuid_hex()
self._create_sp(sp_id, fixtures.sp_ref(enabled=False))
disabled_sps.append(sp_id)
sps_in_token_ids = [
sp['id'] for sp in
self.sps_client.get_service_providers_in_token()]
# Should be equal to the enabled_sps list
self.assertItemsEqual(enabled_sps, sps_in_token_ids)
for enabled_sp in enabled_sps:
self.assertIn(enabled_sp, sps_in_token_ids)
for disabled_sp in disabled_sps:
self.assertNotIn(disabled_sp, sps_in_token_ids)