-
Tomáš Čejka authored
The tests can be executed by: `pytest` To see the output, use `pytest --verbosity=4 --capture=tee-sys` Server does not need to be running for the tests, pytest can start own django service that responds (e.g., to REST API). It is necessary to have created DB with `admin` user having a REST API token! The `test_viewsets.py` sets DB in `django_db_setup()` fixture.
Tomáš Čejka authoredThe tests can be executed by: `pytest` To see the output, use `pytest --verbosity=4 --capture=tee-sys` Server does not need to be running for the tests, pytest can start own django service that responds (e.g., to REST API). It is necessary to have created DB with `admin` user having a REST API token! The `test_viewsets.py` sets DB in `django_db_setup()` fixture.
test_views.py 347 B
import pytest
from views import welcome
#@pytest.mark.asyncio
#async def test_welcome(async_rf):
# request = await aync_rf.get('/welcome/')
# response = welcome(request)
# assert response.status_code == 200
def test_welcome(rf):
request = rf.get('/welcome/')
response = welcome(request)
assert response.status_code == 200