Files
Projet13/tests/unit/profiles/test_views.py
2025-09-10 12:33:33 +02:00

19 lines
493 B
Python

import pytest
from django.test import Client
from django.urls import reverse
from bs4 import BeautifulSoup
@pytest.mark.django_db
def test_view_should_display_right_len_list(sample_profile):
"""
test that html page displays the right amount of objects
created by fixture
"""
c = Client()
url = reverse('profiles_index')
response = c.get(url)
soup = BeautifulSoup(response.content, 'html.parser')
li_tags = soup.find_all('li')
assert len(li_tags) == 3