-
-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Add view controllers * fix: remove = character * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * test: add integration tests for views * fix: pytest namespacing options * fix: tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * style: Refactor code to make things cleaner --------- Co-authored-by: Mikaeel <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sanskar Jethi <[email protected]>
- Loading branch information
1 parent
505b012
commit 5f437d1
Showing
9 changed files
with
136 additions
and
6 deletions.
There are no files selected for viewing
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
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,41 @@ | ||
from helpers.http_methods_helpers import get, post | ||
|
||
|
||
def test_get_sync_view(session): | ||
r = get("/sync/view") | ||
assert r.text == "Hello, world!" | ||
|
||
|
||
def test_post_sync_view(session): | ||
r = post("/sync/view", data={"name": "John"}) | ||
assert "John" in r.text | ||
|
||
|
||
def test_get_sync_decorator_view(session): | ||
r = get("/sync/view/decorator") | ||
assert r.text == "Hello, world!" | ||
|
||
|
||
def test_post_sync_decorator_view(session): | ||
r = post("/sync/view/decorator", data={"name": "John"}) | ||
assert "John" in r.text | ||
|
||
|
||
def test_get_async_view(session): | ||
r = get("/async/view") | ||
assert r.text == "Hello, world!" | ||
|
||
|
||
def test_post_async_view(session): | ||
r = post("/async/view", data={"name": "John"}) | ||
assert "John" in r.text | ||
|
||
|
||
def test_get_async_decorator_view(session): | ||
r = get("/async/view/decorator") | ||
assert r.text == "Hello, world!" | ||
|
||
|
||
def test_post_async_decorator_view(session): | ||
r = post("/async/view/decorator", data={"name": "John"}) | ||
assert "John" in r.text |
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,4 @@ | ||
from .sync_view import SyncView | ||
from .async_view import AsyncView | ||
|
||
__all__ = ["SyncView", "AsyncView"] |
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,11 @@ | ||
def AsyncView(): | ||
async def get(): | ||
return "Hello, world!" | ||
|
||
async def post(request): | ||
body = bytes(request["body"]).decode("utf-8") | ||
return { | ||
"status": 200, | ||
"body": body, | ||
"headers": {"Content-Type": "text/json"}, | ||
} |
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,11 @@ | ||
def SyncView(): | ||
def get(): | ||
return "Hello, world!" | ||
|
||
def post(request): | ||
body = bytes(request["body"]).decode("utf-8") | ||
return { | ||
"status": 200, | ||
"body": body, | ||
"headers": {"Content-Type": "text/json"}, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ uvloop; platform_system!="Windows" | |
watchdog==2.2.1 | ||
multiprocess==0.70.14 | ||
jinja2==3.1.2 | ||
nestd==0.3.1 |
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