'Test project uniqueness for those acting as domains.
If it is a project acting as a domain, we can\'t have two or more with
the same name.'

@unit.skip_if_no_multiple_domains_support
def test_project_as_a_domain_uniqueness_constraints(self):

    project = unit.new_project_ref(is_domain=True)
    project = self.resource_api.create_project(project['id'], project)
    project2 = unit.new_project_ref(is_domain=True)
    project2 = self.resource_api.create_project(project2['id'], project2)
    new_project = project.copy()
    new_project['id'] = uuid.uuid4().hex
    self.assertRaises(exception.Conflict, self.resource_api.create_project, new_project['id'], new_project)
    project2['name'] = project['name']
    self.assertRaises(exception.Conflict, self.resource_api.update_project, project2['id'], project2)
    project2['name'] = uuid.uuid4().hex
    self.resource_api.update_project(project2['id'], project2)
    project3 = unit.new_project_ref(domain_id=CONF.identity.default_domain_id, name=project2['name'])
    self.resource_api.create_project(project3['id'], project3)
