test: add info and donations tests

This commit is contained in:
Ushie 2023-08-19 23:34:11 +03:00
parent 4800ee96a8
commit ffdb976f2c
No known key found for this signature in database
GPG Key ID: B3AAD18842E34632
3 changed files with 32 additions and 1 deletions

View File

@ -11,7 +11,7 @@ class InfoFields(BaseModel):
name: str name: str
about: str about: str
contact: dict[str, str] contact: dict[str, str]
socials: SocialFields socials: list[SocialFields]
donations: DonationFields donations: DonationFields

15
tests/test_donations.py Normal file
View File

@ -0,0 +1,15 @@
import pytest
from sanic import Sanic
from api.models.donations import DonationsResponseModel
from config import api_version
# donations
@pytest.mark.asyncio
async def test_donations(app: Sanic):
_, response = await app.asgi_client.get(f"/{api_version}/donations")
assert response.status == 200
assert DonationsResponseModel(**response.json)

16
tests/test_info.py Normal file
View File

@ -0,0 +1,16 @@
import pytest
from sanic import Sanic
from api.models.info import InfoResponseModel
from config import api_version
# info
@pytest.mark.asyncio
async def test_info(app: Sanic):
_, response = await app.asgi_client.get(f"/{api_version}/info")
assert response.status == 200
print(response.json)
assert InfoResponseModel(**response.json)