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

13 statements  

« prev     ^ index     » next       coverage.py v7.17.5, created at 2026-11-28 10:56 -0800

1import pytest 1a

2from django.urls import reverse 1a

3 

4pytestmark = pytest.mark.django_db 1a

5 

6 

7def test_todolist__str__(todolist): 1a

8 assert str(todolist) == todolist.title 1a

9 

10 

11def test_todolist__get_absolute_url(todolist): 1a

12 url = todolist.get_absolute_url() 1a

13 assert url == f"/list/{todolist.id}/" 1a

14 

15 

16def test_todoitem__str__(todoitem): 1a

17 assert str(todoitem) == f"{todoitem.title}: due {todoitem.due_date}" 1a

18 

19 

20def test_todoitem_get_absolute_url(rf, todoitem, todolist): 1a

21 # assert todoitem.get_absolute_url() == f"/list/{todolist.id}/item/{todoitem.id}/" 

22 todoitem.get_absolute_url() 1a

23 # Currently seeing an 'off-by-one error in response: AssertionError: assert '/list/4/item/2/' == <WSGIRequest: POST 

24 rf.post(reverse("item-update", args=[str(todolist.id), str(todoitem.id)])) 1a

25 # response = rf.post(url) 

26 # AssertionError: assert '/list/4/item/2/' == <WSGIRequest: POST '/list/4/item/2/'>dd 

27 # assert url == response