-
-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Refactor and add test for
paginated_return_data.py
- Loading branch information
kedod
committed
Apr 30, 2024
1 parent
d5196ed
commit 652c43f
Showing
3 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
6 changes: 4 additions & 2 deletions
6
docs/examples/data_transfer_objects/factory/paginated_return_data.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/examples/test_data_transfer_objects/test_factory/test_paginated_return_data.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from litestar.status_codes import HTTP_200_OK | ||
from litestar.testing.client import TestClient | ||
|
||
|
||
def test_create_user() -> None: | ||
from docs.examples.data_transfer_objects.factory.paginated_return_data import app | ||
|
||
with TestClient(app=app) as client: | ||
response = client.get("/users") | ||
|
||
assert response.status_code == HTTP_200_OK | ||
assert response.json() == { | ||
"current_page": 1, | ||
"items": [{"id": 1, "name": "Litestar User"}], | ||
"page_size": 10, | ||
"total_pages": 1, | ||
} |