本文整理汇总了Python中b3.clients.Client.remGroup方法的典型用法代码示例。如果您正苦于以下问题:Python Client.remGroup方法的具体用法?Python Client.remGroup怎么用?Python Client.remGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类b3.clients.Client
的用法示例。
在下文中一共展示了Client.remGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Test_Client_groups
# 需要导入模块: from b3.clients import Client [as 别名]
# 或者: from b3.clients.Client import remGroup [as 别名]
class Test_Client_groups(B3TestCase):
def setUp(self):
B3TestCase.setUp(self)
self.client = Client(console=self.console)
self.group_guest = self.console.storage.getGroup(Group(keyword="guest"))
self.group_user = self.console.storage.getGroup(Group(keyword="user"))
self.group_reg = self.console.storage.getGroup(Group(keyword="reg"))
self.group_mod = self.console.storage.getGroup(Group(keyword="mod"))
self.group_admin = self.console.storage.getGroup(Group(keyword="admin"))
self.group_fulladmin = self.console.storage.getGroup(Group(keyword="fulladmin"))
self.group_senioradmin = self.console.storage.getGroup(Group(keyword="senioradmin"))
self.group_superadmin = self.console.storage.getGroup(Group(keyword="superadmin"))
def assertGroups(self, groups):
keywords = map(operator.attrgetter('keyword'), groups)
self.assertListEqual(keywords, map(operator.attrgetter('keyword'), self.client.groups))
self.assertListEqual(keywords, map(operator.attrgetter('keyword'), self.client.getGroups()))
def test_addGroup(self):
# GIVEN
self.client.addGroup(self.group_mod)
self.assertGroups([self.group_mod])
# WHEN
self.client.addGroup(self.group_superadmin)
# THEN
self.assertGroups([self.group_mod, self.group_superadmin])
def test_rmGroup(self):
# GIVEN
self.client.addGroup(self.group_mod)
self.assertGroups([self.group_mod])
self.client.addGroup(self.group_superadmin)
# WHEN
self.client.remGroup(self.group_mod)
# THEN
self.assertGroups([self.group_superadmin])
def test_guest_group_is_the_default_group_when_none(self):
self.assertGroups([self.group_guest])
self.client.remGroup(self.group_guest)
self.assertGroups([self.group_guest])
self.client.addGroup(self.group_admin)
self.assertGroups([self.group_admin])
def test_inGroup(self):
self.assertFalse(self.client.inGroup(self.group_guest))
self.assertFalse(self.client.inGroup(self.group_user))
self.assertFalse(self.client.inGroup(self.group_reg))
self.assertFalse(self.client.inGroup(self.group_mod))
self.assertFalse(self.client.inGroup(self.group_admin))
self.assertFalse(self.client.inGroup(self.group_fulladmin))
self.assertFalse(self.client.inGroup(self.group_senioradmin))
self.assertFalse(self.client.inGroup(self.group_superadmin))
self.client.addGroup(self.group_user)
self.assertTrue(self.client.inGroup(self.group_user))
self.client.addGroup(self.group_reg)
self.assertTrue(self.client.inGroup(self.group_reg))
self.client.addGroup(self.group_mod)
self.assertTrue(self.client.inGroup(self.group_mod))
self.client.addGroup(self.group_admin)
self.assertTrue(self.client.inGroup(self.group_admin))
self.client.addGroup(self.group_fulladmin)
self.assertTrue(self.client.inGroup(self.group_fulladmin))
self.client.addGroup(self.group_senioradmin)
self.assertTrue(self.client.inGroup(self.group_senioradmin))
self.client.addGroup(self.group_superadmin)
self.assertTrue(self.client.inGroup(self.group_superadmin))