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
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-16 16:36 -0700
1import pytest
3from ..models import Cheese # noqa:F401
4from .factories import CheeseFactory
6# Connects our tests with our database
7pytestmark = pytest.mark.django_db
10def test__str__():
11 cheese = CheeseFactory() 1b
12 assert cheese.__str__() == cheese.name 1b
13 assert str(cheese) == cheese.name 1b
16def test_get_absolute_url():
17 cheese = CheeseFactory() 1c
18 url = cheese.get_absolute_url() 1c
19 assert url == f"/cheeses/{cheese.slug}/" 1c