def test_comment_detail_for_deleted_wiki_is_not_returned(self): self._set_up_private_project_with_comment() # Delete commented wiki page self.private_project.delete_node_wiki(self.wiki.page_name, core.Auth(self.user)) res = self.app.get(self.private_url, auth=self.user.auth, expect_errors=True) assert_equal(res.status_code, 404)
def setUp(self): super(TestCommentFiltering, self).setUp() self.user = AuthUserFactory() self.project = ProjectFactory(creator=self.user) self.comment = CommentFactory(node=self.project, user=self.user) self.deleted_comment = CommentFactory(node=self.project, user=self.user, is_deleted=True) self.base_url = '/{}nodes/{}/comments/'.format(API_BASE, self.project._id) self.formatted_date_created = self.comment.date_created.strftime( '%Y-%m-%dT%H:%M:%S.%f') self.comment.edit('Edited comment', auth=core.Auth(self.user), save=True) self.formatted_date_modified = self.comment.date_modified.strftime( '%Y-%m-%dT%H:%M:%S.%f')
def get_attribute(self, obj): user = self.context['request'].user auth = auth_core.Auth(user) field_source_method = getattr(obj, self.source) return field_source_method(auth=auth)
def test_comment_detail_for_deleted_wiki_is_not_returned( self, app, user, wiki, private_url, private_project): # Delete commented wiki page private_project.delete_node_wiki(wiki.page_name, core.Auth(user)) res = app.get(private_url, auth=user.auth, expect_errors=True) assert res.status_code == 404