'List all available IdentityProviders.
This test collects ids of created IdPs and
intersects it with the list of all available IdPs.
List of all IdPs can be a superset of IdPs created in this test,
because other tests also create IdPs.'

def test_list_head_idps(self, iterations=5):

    def get_id(resp):
        r = self._fetch_attribute_from_response(resp, 'identity_provider')
        return r.get('id')
    ids = []
    for _ in range(iterations):
        id = get_id(self._create_default_idp())
        ids.append(id)
    ids = set(ids)
    keys_to_check = self.idp_keys
    keys_to_check.append('domain_id')
    url = self.base_url()
    resp = self.get(url)
    self.assertValidListResponse(resp, 'identity_providers', dummy_validator, keys_to_check=keys_to_check)
    entities = self._fetch_attribute_from_response(resp, 'identity_providers')
    entities_ids = set([e['id'] for e in entities])
    ids_intersection = entities_ids.intersection(ids)
    self.assertEqual(ids_intersection, ids)
    self.head(url, expected_status=http_client.OK)
