def test_incorrect_number_of_likes(self):
        user2 = sample_user("user2", "pass123")
        comment = sample_comment(self.user, self.song)

        sample_comment_like(self.user, comment)
        sample_comment_like(user2, comment)

        self.assertNotEqual(comment.no_of_likes(), 1)
    def test_retrieve_comments_success(self):

        sample_comment_like(self.user, self.comment)

        response = self.client.get(COMMENT_LIKE_URL)

        likes = CommentLike.objects.all()
        serializer = CommentLikeSerializer(likes, many=True)

        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(response.data, serializer.data)
    def test_str_representation(self):
        comment_like = sample_comment_like(self.user, self.comment)

        self.assertEqual(str(comment_like), f"{self.user} - {self.comment}")
    def test_put_method_not_allowed(self):
        like = sample_comment_like(self.user, self.comment)
        response = self.client.put(get_comment_like_detail_url(like.id))

        self.assertEqual(response.status_code,
                         status.HTTP_405_METHOD_NOT_ALLOWED)