From dd7b24018b564f244eb029b70ad4090fed3fbf87 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Tue, 18 Aug 2020 08:36:55 +0200 Subject: [PATCH] Add test --- articles/tests/test_articles.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/articles/tests/test_articles.py b/articles/tests/test_articles.py index 26c6331..6e5488d 100644 --- a/articles/tests/test_articles.py +++ b/articles/tests/test_articles.py @@ -33,3 +33,12 @@ def test_abstract_shown_on_list(client: Client, author: User): content = res.content.decode("utf-8") assert abstract in content assert after not in content + + +@pytest.mark.django_db +def test_access_article_by_slug(client: Client, published_article: Article): + res = client.get(reverse("article-detail", kwargs={"slug": published_article.slug})) + assert res.status_code == 200 + content = res.content.decode("utf-8") + assert published_article.title in content + assert published_article.get_formatted_content() in content