'Test listing of service provider objects.
Add two new service providers. List all available service providers.
Expect to get list of three service providers (one created by setUp())
Test if attributes match.'

def test_list_head_service_providers(self):

    ref_service_providers = {uuid.uuid4().hex: self.sp_ref(), uuid.uuid4().hex: self.sp_ref()}
    for (id, sp) in ref_service_providers.items():
        url = self.base_url(suffix=id)
        self.put(url, body={'service_provider': sp}, expected_status=http_client.CREATED)
    ref_service_providers[self.SERVICE_PROVIDER_ID] = self.SP_REF
    for (id, sp) in ref_service_providers.items():
        sp['id'] = id
    url = self.base_url()
    resp = self.get(url)
    service_providers = resp.result
    for service_provider in service_providers['service_providers']:
        id = service_provider['id']
        self.assertValidEntity(service_provider, ref=ref_service_providers[id], keys_to_check=self.SP_KEYS)
    self.head(url, expected_status=http_client.OK)
