Example #1
0
    def test_accepts_any_authority_for_unauthed_user(self, pyramid_request,
                                                     authority_group_service):
        svc = profile_groups_factory(None, pyramid_request)

        svc.all(authority='foo')

        authority_group_service.public_groups.assert_called_once_with('foo')
Example #2
0
    def test_wraps_auth_group_service_as_finder(self, pyramid_request,
                                                authority_group_service):
        svc = profile_groups_factory(None, pyramid_request)

        svc.all(authority='foo')

        authority_group_service.public_groups.assert_called_once_with('foo')
Example #3
0
    def test_authority_default_to_request_for_unauthenticated_user(
            self, pyramid_request, authority_group_service):
        pyramid_request.authority = 'rando.com'
        svc = profile_groups_factory(None, pyramid_request)

        svc.all()

        authority_group_service.public_groups.assert_called_once_with(
            'rando.com')
Example #4
0
    def test_overrides_authority_with_user_authority(self, pyramid_request,
                                                     factories,
                                                     authority_group_service):
        pyramid_request.authority = 'rando.com'
        svc = profile_groups_factory(None, pyramid_request)
        user = factories.User()

        svc.all(user)

        authority_group_service.public_groups.assert_called_once_with(
            user.authority)
Example #5
0
    def test_provides_request_db_as_session(self, pyramid_request):
        svc = profile_groups_factory(None, pyramid_request)

        assert svc.session == pyramid_request.db
Example #6
0
    def test_returns_profile_group_service(self, pyramid_request):
        svc = profile_groups_factory(None, pyramid_request)

        assert isinstance(svc, ProfileGroupService)