Coverage for posts/tests/test_models.py: 100.00%

11 statements  

« prev     ^ index     » next       coverage.py v7.16.1, created at 2026-09-22 12:02 -0700

1from datetime import datetime as dt 1a

2 

3import pytest 1a

4 

5pytestmark = pytest.mark.django_db 1a

6 

7 

8def test_post___str__(post): 1a

9 assert post.__str__() == post.title 1a

10 assert str(post) == post.title 1a

11 

12 

13def test_post_get_absolute_url(post): 1a

14 slug_time = dt.now().strftime("%Y/%-m/%-d") 1a

15 assert post.get_absolute_url() == f"/posts/{slug_time}/{post.slug}/" 1a

16 

17 

18def test_comment__str__(comment): 1a

19 assert comment.__str__() == f"Comment by {comment.name} on {comment.post}" 1a