def setUp(self): super(UpdateCommentTests, self).setUp() self.user = UserFactory.create() self.comment = CommentFactory.create(user=self.user) self.path = reverse('publisher_comments:api:comments', kwargs={'pk': self.comment.id}) self.data = {'comment': 'updated comment'}
def test_data(self): """ Verify that CommentsSerializer serialize the comment object. """ comment = CommentFactory.create(comment='test comment') serializer = CommentSerializer(comment) expected = {'comment': 'test comment', 'modified': comment.modified.strftime("%Y-%m-%dT%H:%M:%S.%fZ")} self.assertDictEqual(serializer.data, expected)
def test_data(self): """ Verify that CommentsSerializer serialize the comment object. """ comment = CommentFactory.create(comment='test comment') serializer = CommentSerializer(comment) expected = { 'comment': 'test comment', 'modified': comment.modified.strftime("%Y-%m-%dT%H:%M:%S.%fZ") } self.assertDictEqual(serializer.data, expected)
def setUp(self): super(IsOwnerTests, self).setUp() self.permissions_class = IsOwner() self.user = UserFactory.create() self.comment = CommentFactory.create(user=self.user, comment='test comment')