示例#1
0
    def test_get_queryset_non_public(self):
        viewset = UserProfileViewSet()
        viewset.request = Mock()
        viewset.request.privacy_level = MOZILLIANS
        with patch('mozillians.users.api.v2.UserProfile') as userprofile_mock:
            viewset.get_queryset()

        ok_(userprofile_mock.objects.complete.called)
        userprofile_mock.objects.complete().privacy_level.assert_called_with(MOZILLIANS)
示例#2
0
    def test_get_queryset_public(self):
        viewset = UserProfileViewSet()
        viewset.request = Mock()
        viewset.request.privacy_level = PUBLIC
        with patch("mozillians.users.api.v2.UserProfile") as userprofile_mock:
            viewset.get_queryset()

        ok_(userprofile_mock.objects.complete.called)
        ok_(userprofile_mock.objects.complete().public.called)
        userprofile_mock.objects.complete().public(
        ).privacy_level.assert_called_with(PUBLIC)