'Create set of protocols and later list them.
Compare input and output id sets.'

def test_list_head_protocols(self):

    (resp, idp_id, proto) = self._assign_protocol_to_idp(expected_status=http_client.CREATED)
    iterations = random.randint(0, 16)
    protocol_ids = []
    for _ in range(iterations):
        (resp, _, proto) = self._assign_protocol_to_idp(idp_id=idp_id, expected_status=http_client.CREATED)
        proto_id = self._fetch_attribute_from_response(resp, 'protocol')
        proto_id = proto_id['id']
        protocol_ids.append(proto_id)
    url = ('%s/protocols' % idp_id)
    url = self.base_url(suffix=url)
    resp = self.get(url)
    self.assertValidListResponse(resp, 'protocols', dummy_validator, keys_to_check=['id'])
    entities = self._fetch_attribute_from_response(resp, 'protocols')
    entities = set([entity['id'] for entity in entities])
    protocols_intersection = entities.intersection(protocol_ids)
    self.assertEqual(protocols_intersection, set(protocol_ids))
    self.head(url, expected_status=http_client.OK)
