Coverage for cheese/cheeses/tests/test_models.py: 100.00%

12 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-16 16:36 -0700

1import pytest 

2 

3from ..models import Cheese # noqa:F401 

4from .factories import CheeseFactory 

5 

6# Connects our tests with our database 

7pytestmark = pytest.mark.django_db 

8 

9 

10def test__str__(): 

11 cheese = CheeseFactory() 1b

12 assert cheese.__str__() == cheese.name 1b

13 assert str(cheese) == cheese.name 1b

14 

15 

16def test_get_absolute_url(): 

17 cheese = CheeseFactory() 1c

18 url = cheese.get_absolute_url() 1c

19 assert url == f"/cheeses/{cheese.slug}/" 1c