コード例 #1
0
    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'}
コード例 #2
0
ファイル: test_views.py プロジェクト: edx/course-discovery
    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'}
コード例 #3
0
    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)
コード例 #4
0
    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)
コード例 #5
0
 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')
コード例 #6
0
 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')