def test_group_has_user(self): user = self.useFixture(fixtures.User(self.sentinel)) group = self.useFixture(fixtures.Group(self.sentinel)) self.assertRaises(http.NotFound, self.sentinel.identity.users.check_in_group, user.entity, group.entity) self.sentinel.identity.users.add_to_group(user.entity, group.entity) self.sentinel.identity.users.check_in_group(user.entity, group.entity)
def def_group_remove_user(self): user = self.useFixture(fixtures.User(self.sentinel)) group = self.useFixture(fixtures.Group(self.sentinel)) self.sentinel.identity.users.add_to_group(user.entity, group.entity) self.sentinel.identity.users.remove_from_group(user.entity, group.entity) self.assertRaises(http.NotFound, self.sentinel.identity.users.remove_from_group, user.entity, group.entity)
def test_update(self): user_fix = self.useFixture(fixtures.User(self.sentinel)) user = self.sentinel.identity.users.update( user_fix.entity, name=TEST_USER, email=TEST_USER_EMAIL, description=TEST_USER_DESCRIPTION, enabled=False) self.assertEqual(user.name, TEST_USER) self.assertEqual(user.email, TEST_USER_EMAIL) self.assertEqual(user.description, TEST_USER_DESCRIPTION) self.assertEqual(user.enabled, False)
def test_group_add_user_taint(self): user = self.useFixture(fixtures.User(self.openstack)) group = self.useFixture(fixtures.Group(self.sentinel)) self.assertRaises(http.Forbidden, self.sentinel.identity.users.add_to_group, user.entity, group.entity)
def test_group_add_user(self): user = self.useFixture(fixtures.User(self.sentinel)) group = self.useFixture(fixtures.Group(self.sentinel)) self.sentinel.identity.users.add_to_group(user.entity, group.entity)
def test_group_list_users(self): user = self.useFixture(fixtures.User(self.sentinel)) group = self.useFixture(fixtures.Group(self.sentinel)) self.sentinel.identity.users.add_to_group(user.entity, group.entity) users = self.sentinel.identity.users.list(group=group.entity) self.assertThat(user.entity, matchers.IsInCollection(users))
def test_list_filtering(self): user = self.useFixture(fixtures.User(self.openstack)) users = self.sentinel.identity.users.list() self.assertThat(user.entity, matchers.IsNotInCollection(users))
def test_list(self): user = self.useFixture(fixtures.User(self.sentinel)) users = self.sentinel.identity.users.list() self.assertThat(user.entity, matchers.IsInCollection(users))
def test_delete_taint(self): user = self.useFixture(fixtures.User(self.openstack)) self.assertRaises(http.Forbidden, self.sentinel.identity.users.delete, user.entity)
def test_get(self): user = self.useFixture(fixtures.User(self.sentinel)) self.sentinel.identity.users.get(user.entity)
def test_update_taint(self): user = self.useFixture(fixtures.User(self.openstack)) self.assertRaises(http.Forbidden, self.sentinel.identity.users.update, user.entity, name=TEST_USER)
def test_create_conflict(self): user = self.useFixture(fixtures.User(self.sentinel)) self.assertRaises(http.Conflict, self.sentinel.identity.users.create, user.entity.name)