'Add same IdP twice.
Expect HTTP 409 Conflict code for the latter call.'

def test_check_idp_uniqueness(self):

    url = self.base_url(suffix=uuid.uuid4().hex)
    body = self._http_idp_input()
    domain = unit.new_domain_ref()
    self.resource_api.create_domain(domain['id'], domain)
    body['domain_id'] = domain['id']
    self.put(url, body={'identity_provider': body}, expected_status=http_client.CREATED)
    resp = self.put(url, body={'identity_provider': body}, expected_status=http_client.CONFLICT)
    resp_data = jsonutils.loads(resp.body)
    self.assertIn('Duplicate    entry', resp_data.get('error', {}).get('message'))
