66from django .urls import reverse
77from django .utils import timezone
88
9+ from djpress .models import Post
10+
911
1012@pytest .mark .django_db
1113def test_index (client , test_post1 ) -> None :
@@ -16,9 +18,9 @@ def test_index(client, test_post1) -> None:
1618
1719
1820@pytest .mark .django_db
19- def test_archives (client , test_post1 ) -> None :
21+ def test_archives (client , test_post1 : Post ) -> None :
2022 """Test archives views."""
21- test_post1 .date = timezone .make_aware (timezone .datetime (2024 , 6 , 1 ))
23+ test_post1 .published_at = timezone .make_aware (timezone .datetime (2024 , 6 , 1 ))
2224 test_post1 .save ()
2325
2426 url = "/2024/"
@@ -35,13 +37,13 @@ def test_archives(client, test_post1) -> None:
3537@pytest .mark .django_db
3638def test_single_post (client , test_post1 ) -> None :
3739 """Test single post view."""
38- url = f"/{ test_post1 .date .year } /{ test_post1 .date .month :02} /test-post1/"
40+ url = f"/{ test_post1 ._date .year } /{ test_post1 ._date .month :02} /test-post1/"
3941 # response: HttpResponse = client.get(url)
4042 # assert test_post1.url == "/2025/04/test-post1/"
4143 # assert response.status_code == 200
4244 # assert "Test Post1" in str(response.content)
4345
44- test_post1 .date = timezone .make_aware (timezone .datetime (2024 , 6 , 15 ))
46+ test_post1 .published_at = timezone .make_aware (timezone .datetime (2024 , 6 , 15 ))
4547 test_post1 .save ()
4648 url = "/2024/06/test-post1/"
4749 response : HttpResponse = client .get (url )
0 commit comments