mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 04:19:25 +00:00
Add GET /api/club/{club_id}
to fetch details about a club
This commit is contained in:
16
club/tests/test_club_controller.py
Normal file
16
club/tests/test_club_controller.py
Normal file
@ -0,0 +1,16 @@
|
||||
import pytest
|
||||
from model_bakery import baker
|
||||
from ninja_extra.testing import TestClient
|
||||
from pytest_django.asserts import assertNumQueries
|
||||
|
||||
from club.api import ClubController
|
||||
from club.models import Club, Membership
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_fetch_club():
|
||||
club = baker.make(Club)
|
||||
baker.make(Membership, club=club, _quantity=10, _bulk_create=True)
|
||||
with assertNumQueries(3):
|
||||
res = TestClient(ClubController).get(f"/{club.id}")
|
||||
assert res.status_code == 200
|
Reference in New Issue
Block a user