'Test that separate configs have segregated the domain.
Test Plan:
- Users were created in each domain as part of setup, now make sure
you can only find a given user in its relevant domain/backend
- Make sure that for a backend that supports multiple domains
you can get the users via any of its domains'

def test_domain_segregation(self):

    users = self.create_users_across_domains()
    check_user = self.check_user
    check_user(users['user0'], self.domain_default['id'], http_client.OK)
    for domain in [self.domains['domain1']['id'], self.domains['domain2']['id'], self.domains['domain3']['id'], self.domains['domain4']['id']]:
        check_user(users['user0'], domain, exception.UserNotFound)
    check_user(users['user1'], self.domains['domain1']['id'], http_client.OK)
    for domain in [self.domain_default['id'], self.domains['domain2']['id'], self.domains['domain3']['id'], self.domains['domain4']['id']]:
        check_user(users['user1'], domain, exception.UserNotFound)
    check_user(users['user2'], self.domains['domain2']['id'], http_client.OK)
    for domain in [self.domain_default['id'], self.domains['domain1']['id'], self.domains['domain3']['id'], self.domains['domain4']['id']]:
        check_user(users['user2'], domain, exception.UserNotFound)
    check_user(users['user3'], self.domains['domain3']['id'], http_client.OK)
    check_user(users['user3'], self.domains['domain4']['id'], http_client.OK)
    check_user(users['user4'], self.domains['domain3']['id'], http_client.OK)
    check_user(users['user4'], self.domains['domain4']['id'], http_client.OK)
    for domain in [self.domain_default['id'], self.domains['domain1']['id'], self.domains['domain2']['id']]:
        check_user(users['user3'], domain, exception.UserNotFound)
        check_user(users['user4'], domain, exception.UserNotFound)
    for domain in [self.domains['domain1']['id'], self.domains['domain2']['id'], self.domains['domain4']['id']]:
        self.assertThat(self.identity_api.list_users(domain_scope=domain), matchers.HasLength(1))
    self.assertThat(self.identity_api.list_users(domain_scope=self.domains['domain3']['id']), matchers.HasLength(1))
