Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /spraakbanken_karp-backend /tests /utils.py
| """Handle calls and json convertions.""" | |
| from fastapi import status | |
| from tests.e2e.conftest import AccessToken | |
| def get_json(client, path: str, expected_status_code: int = status.HTTP_200_OK, **kwargs): | |
| """Call the get on the client with the given path. | |
| Assert that the status_code is ok. | |
| Then load the json response. | |
| Arguments: | |
| client {[type]} -- [description] | |
| path {[type]} -- [description] | |
| Returns: | |
| [type] -- [description] | |
| """ | |
| response = client.get(path, **kwargs) | |
| response_json = response.json() | |
| print(f"{response_json=}") | |
| assert response.status_code == expected_status_code | |
| return response_json | |
| def add_entries(client, entries: dict, access_token: AccessToken): | |
| for resource, _entries in entries.items(): | |
| for entry in _entries: | |
| response = client.put( | |
| f"/entries/{resource}", | |
| json={"entry": entry}, | |
| headers=access_token.as_header(), | |
| ) | |
| assert response.status_code == 201, f"Response(status_code={response.status_code}, json={response.json()})" | |
| return client | |
Xet Storage Details
- Size:
- 1.14 kB
- Xet hash:
- b7b326794a51b7421ec9b4217b4e99c0c828b2bb0eafc93d866c45dc3265da21
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.