Skip to content

Как тестить Django с помощью pytest?

@pytest.mark.django_db
def test_ok(client):
    resp: HttpResponse = client.post(
        '/api/...',
        {
            # json
        },
        content_type='application/json',
    )

    assert resp.status_code == 200