當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。