'Call ``PATCH /domains/{domain_id}`` (set enabled=False).'

def test_disable_domain(self):

    domain2 = unit.new_domain_ref()
    self.resource_api.create_domain(domain2['id'], domain2)
    project2 = unit.new_project_ref(domain_id=domain2['id'])
    self.resource_api.create_project(project2['id'], project2)
    user2 = unit.create_user(self.identity_api, domain_id=domain2['id'], project_id=project2['id'])
    self.assignment_api.add_user_to_project(project2['id'], user2['id'])
    body = {'auth': {'passwordCredentials': {'userId': user2['id'], 'password': user2['password']}, 'tenantId': project2['id']}}
    self.admin_request(path='/v2.0/tokens', method='POST', body=body)
    auth_data = self.build_authentication_request(user_id=user2['id'], password=user2['password'], project_id=project2['id'])
    self.v3_create_token(auth_data)
    domain2['enabled'] = False
    r = self.patch(('/domains/%(domain_id)s' % {'domain_id': domain2['id']}), body={'domain': {'enabled': False}})
    self.assertValidDomainResponse(r, domain2)
    body = {'auth': {'passwordCredentials': {'userId': user2['id'], 'password': user2['password']}, 'tenantId': project2['id']}}
    self.admin_request(path='/v2.0/tokens', method='POST', body=body, expected_status=http_client.UNAUTHORIZED)
    auth_data = self.build_authentication_request(user_id=user2['id'], password=user2['password'], project_id=project2['id'])
    self.v3_create_token(auth_data, expected_status=http_client.UNAUTHORIZED)
    auth_data = self.build_authentication_request(username=user2['name'], user_domain_id=domain2['id'], password=user2['password'], project_id=project2['id'])
    self.v3_create_token(auth_data, expected_status=http_client.UNAUTHORIZED)
