def test_filter_view_queryset__private_channel(self): channel = testdata.channel() assessment_item = create_assessment_item(channel.main_tree_id) queryset = AssessmentItem.filter_view_queryset( self.base_queryset, user=self.forbidden_user) self.assertQuerysetDoesNotContain(queryset, pk=assessment_item.id) user = testdata.user() channel.viewers.add(user) queryset = AssessmentItem.filter_view_queryset(self.base_queryset, user=user) self.assertQuerysetContains(queryset, pk=assessment_item.id)
def test_filter_view_queryset__private_channel__anonymous(self): channel = testdata.channel() assessment_item = create_assessment_item(channel.main_tree_id) queryset = AssessmentItem.filter_view_queryset( self.base_queryset, user=self.anonymous_user) self.assertQuerysetDoesNotContain(queryset, pk=assessment_item.id)
def test_filter_view_queryset__public_channel__anonymous(self): channel = self.public_channel assessment_item = create_assessment_item(channel.main_tree_id) queryset = AssessmentItem.filter_view_queryset( self.base_queryset, user=self.anonymous_user) self.assertQuerysetContains(queryset, pk=assessment_item.id)