当前位置: 首页>>代码示例>>Python>>正文


Python group.GroupService类代码示例

本文整理汇总了Python中h.services.group.GroupService的典型用法代码示例。如果您正苦于以下问题:Python GroupService类的具体用法?Python GroupService怎么用?Python GroupService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GroupService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_create_publishes_join_event

    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')
开发者ID:gnott,项目名称:h,代码行数:7,代码来源:group_test.py

示例2: test_member_join_is_idempotent

    def test_member_join_is_idempotent(self, db_session, group, users):
        svc = GroupService(db_session, users.get)

        svc.member_join(group, 'theresa')
        svc.member_join(group, 'theresa')

        assert group.members.count(users['theresa']) == 1
开发者ID:gnott,项目名称:h,代码行数:7,代码来源:group_test.py

示例3: test_create_sets_group_ids

    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
开发者ID:gnott,项目名称:h,代码行数:7,代码来源:group_test.py

示例4: test_member_join_publishes_join_event

    def test_member_join_publishes_join_event(self, db_session, group, users):
        publish = mock.Mock(spec_set=[])
        svc = GroupService(db_session, users.get, publish=publish)
        group.pubid = 'abc123'

        svc.member_join(group, 'theresa')

        publish.assert_called_once_with('group-join', 'abc123', 'theresa')
开发者ID:gnott,项目名称:h,代码行数:8,代码来源:group_test.py

示例5: test_member_leave_removes_user_from_group

    def test_member_leave_removes_user_from_group(self, db_session, users):
        svc = GroupService(db_session, users.get)
        group = Group(name='Theresa and her buddies',
                      authority='foobar.com',
                      creator=users['theresa'])
        group.members.append(users['cazimir'])

        svc.member_leave(group, 'cazimir')

        assert users['cazimir'] not in group.members
开发者ID:gnott,项目名称:h,代码行数:10,代码来源:group_test.py

示例6: test_create_sets_access_flags_for_group_types

    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
开发者ID:gnott,项目名称:h,代码行数:11,代码来源:group_test.py

示例7: test_member_leave_publishes_leave_event

    def test_member_leave_publishes_leave_event(self, db_session, users):
        publish = mock.Mock(spec_set=[])
        svc = GroupService(db_session, users.get, publish=publish)
        group = Group(name='Donkey Trust',
                      authority='foobari.com',
                      creator=users['theresa'])
        group.members.append(users['cazimir'])
        group.pubid = 'abc123'

        svc.member_leave(group, 'cazimir')

        publish.assert_called_once_with('group-leave', 'abc123', 'cazimir')
开发者ID:gnott,项目名称:h,代码行数:12,代码来源:group_test.py

示例8: test_create_adds_group_to_session

    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
开发者ID:gnott,项目名称:h,代码行数:6,代码来源:group_test.py

示例9: test_create_raises_for_invalid_group_type

    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')
开发者ID:gnott,项目名称:h,代码行数:5,代码来源:group_test.py

示例10: test_create_skips_setting_description_when_missing

    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
开发者ID:gnott,项目名称:h,代码行数:6,代码来源:group_test.py

示例11: test_create_sets_description_when_present

    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'
开发者ID:gnott,项目名称:h,代码行数:6,代码来源:group_test.py

示例12: test_create_sets_group_authority

    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'
开发者ID:gnott,项目名称:h,代码行数:6,代码来源:group_test.py

示例13: test_create_returns_group

    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)
开发者ID:gnott,项目名称:h,代码行数:6,代码来源:group_test.py

示例14: test_member_join_adds_user_to_group

    def test_member_join_adds_user_to_group(self, db_session, group, users):
        svc = GroupService(db_session, users.get)

        svc.member_join(group, 'theresa')

        assert users['theresa'] in group.members
开发者ID:gnott,项目名称:h,代码行数:6,代码来源:group_test.py

示例15: test_create_doesnt_add_group_creator_to_members_for_publisher_groups

    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
开发者ID:soapdog,项目名称:h,代码行数:6,代码来源:group_test.py


注:本文中的h.services.group.GroupService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。