Commit 0bea96ad authored by Okhin's avatar Okhin
Browse files

Adding a test to check that you're not allowed to upvote a published article

parent 12884ba6
Pipeline #2661 passed with stages
in 3 minutes and 44 seconds
from django.urls import reverse
from django.test import TestCase
from django.contrib.auth.models import Permission, User
from django.contrib.auth.models import Permission
from rest_framework.test import APIClient
from rest_framework.test import APIRequestFactory, force_authenticate
......@@ -75,3 +75,12 @@ class VoteViewTestCase(TestCase):
article_db = Article.objects.get(
assert article_db.status == "REJECTED"
def test_votes_error_if_publish(self):
article = ArticleFactory(status="PUBLISHED")
url_upvote = reverse("api:article-upvote", kwargs={
response =
assert response.status_code == 400
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment