本文整理汇总了Python中h.services.group.GroupService.create方法的典型用法代码示例。如果您正苦于以下问题:Python GroupService.create方法的具体用法?Python GroupService.create怎么用?Python GroupService.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类h.services.group.GroupService
的用法示例。
在下文中一共展示了GroupService.create方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_sets_group_ids
# 需要导入模块: from h.services.group import GroupService [as 别名]
# 或者: from h.services.group.GroupService import create [as 别名]
def test_create_sets_group_ids(self, db_session, users):
svc = GroupService(db_session, users.get)
group = svc.create('Anteater fans', 'foobar.com', 'cazimir')
assert group.id
assert group.pubid
示例2: test_create_publishes_join_event
# 需要导入模块: from h.services.group import GroupService [as 别名]
# 或者: from h.services.group.GroupService import create [as 别名]
def test_create_publishes_join_event(self, db_session, users):
publish = mock.Mock(spec_set=[])
svc = GroupService(db_session, users.get, publish=publish)
group = svc.create('Dishwasher disassemblers', 'foobar.com', 'theresa')
publish.assert_called_once_with('group-join', group.pubid, 'theresa')
示例3: test_create_sets_access_flags_for_group_types
# 需要导入模块: from h.services.group import GroupService [as 别名]
# 或者: from h.services.group.GroupService import create [as 别名]
def test_create_sets_access_flags_for_group_types(self,
db_session,
users,
group_type,
flag,
expected_value):
svc = GroupService(db_session, users.get)
group = svc.create('Anteater fans', 'foobar.com', 'cazimir', type_=group_type)
assert getattr(group, flag) == expected_value
示例4: test_create_adds_group_to_session
# 需要导入模块: from h.services.group import GroupService [as 别名]
# 或者: from h.services.group.GroupService import create [as 别名]
def test_create_adds_group_to_session(self, db_session, users):
svc = GroupService(db_session, users.get)
group = svc.create('Anteater fans', 'foobar.com', 'cazimir')
assert group in db_session
示例5: test_create_raises_for_invalid_group_type
# 需要导入模块: from h.services.group import GroupService [as 别名]
# 或者: from h.services.group.GroupService import create [as 别名]
def test_create_raises_for_invalid_group_type(self, db_session, users):
svc = GroupService(db_session, users.get)
with pytest.raises(ValueError):
svc.create('Anteater fans', 'foobar.com', 'cazimir', type_='foo')
示例6: test_create_skips_setting_description_when_missing
# 需要导入模块: from h.services.group import GroupService [as 别名]
# 或者: from h.services.group.GroupService import create [as 别名]
def test_create_skips_setting_description_when_missing(self, db_session, users):
svc = GroupService(db_session, users.get)
group = svc.create('Anteater fans', 'foobar.com', 'cazimir')
assert group.description is None
示例7: test_create_sets_description_when_present
# 需要导入模块: from h.services.group import GroupService [as 别名]
# 或者: from h.services.group.GroupService import create [as 别名]
def test_create_sets_description_when_present(self, db_session, users):
svc = GroupService(db_session, users.get)
group = svc.create('Anteater fans', 'foobar.com', 'cazimir', 'all about ant eaters')
assert group.description == 'all about ant eaters'
示例8: test_create_sets_group_authority
# 需要导入模块: from h.services.group import GroupService [as 别名]
# 或者: from h.services.group.GroupService import create [as 别名]
def test_create_sets_group_authority(self, db_session, users):
svc = GroupService(db_session, users.get)
group = svc.create('Anteater fans', 'foobar.com', 'cazimir')
assert group.authority == 'foobar.com'
示例9: test_create_returns_group
# 需要导入模块: from h.services.group import GroupService [as 别名]
# 或者: from h.services.group.GroupService import create [as 别名]
def test_create_returns_group(self, db_session, users):
svc = GroupService(db_session, users.get)
group = svc.create('Anteater fans', 'foobar.com', 'cazimir')
assert isinstance(group, Group)
示例10: test_create_doesnt_add_group_creator_to_members_for_publisher_groups
# 需要导入模块: from h.services.group import GroupService [as 别名]
# 或者: from h.services.group.GroupService import create [as 别名]
def test_create_doesnt_add_group_creator_to_members_for_publisher_groups(self, db_session, users):
svc = GroupService(db_session, users.get)
group = svc.create('Anteater fans', 'foobar.com', 'cazimir', type_='publisher')
assert users['cazimir'] not in group.members
示例11: test_create_adds_group_creator_to_members
# 需要导入模块: from h.services.group import GroupService [as 别名]
# 或者: from h.services.group.GroupService import create [as 别名]
def test_create_adds_group_creator_to_members(self, db_session, users):
svc = GroupService(db_session, users.get)
group = svc.create('Anteater fans', 'foobar.com', 'cazimir')
assert users['cazimir'] in group.members