Commit ac98fec2 authored by okhin's avatar okhin 🚴

Merge branch...

Merge branch '57-d-apres-les-transitions-possibles-un-article-publie-est-fortement-limite' into 'rp2'

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

See merge request !53
parents 12884ba6 0bea96ad
Pipeline #2663 passed with stages
in 4 minutes and 45 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(id=self.article.id)
assert article_db.status == "REJECTED"
def test_votes_error_if_publish(self):
article = ArticleFactory(status="PUBLISHED")
url_upvote = reverse("api:article-upvote", kwargs={
"pk": article.id
})
response = self.client.post(url_upvote)
assert response.status_code == 400
Markdown is supported
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