-
Notifications
You must be signed in to change notification settings - Fork 3
Test Client
Dawid Kraczkowski edited this page Feb 27, 2021
·
1 revision
Test client is a small utility class to simplify end to end testing of your application. If you are using pytest library it is recommended to create a mock, like below:
testconf.py
import chocs
import my_application
@pytest.fixture
def test_client() -> chocs.TestClient:
client = TestClient(my_application.app)
return clientimport chocs
def test_get_request(test_client: chocs.TestClient) -> None:
response = test_client.get("/users?id=12")
assert response.status_code is chocs.HttpStatus.OK- Creating new application
- Registering a controller
- Grouping controllers
- Registering middleware
- Dynamically loading modules
TBA
TBA
- Reading request's body
- Accessing request's parsed body
- Accessing request's headers
- Accessing path's parameters
- Reading client cookies
- Comparing requests objects
- API