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

10 statements  

« prev     ^ index     » next       coverage.py v7.17.2, created at 2026-11-10 10:53 -0800

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 str(post) == post.title 1a

10 

11 

12def test_post_get_absolute_url(post): 1a

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

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

15 

16 

17def test_comment__str__(comment): 1a

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