-
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add integration tests for views
- Loading branch information
Showing
5 changed files
with
51 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from http_methods_helpers import get, post | ||
|
||
|
||
def test_view(session): | ||
r = get("/test_view") | ||
assert r.status_code == 200 | ||
assert r.text == "Get Request!" | ||
|
||
r = post("/test_view", data={"name": "John"}) | ||
assert r.status_code == 200 | ||
assert r.text == "Post Request!" | ||
|
||
|
||
def test_decorator_view(session): | ||
r = get("/test_decorator_view") | ||
assert r.status_code == 200 | ||
assert r.text == "Hello, world!" | ||
|
||
r = post("/test_decorator_view") | ||
assert r.status_code == 200 | ||
assert r.text == "Hello, world!" |
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,12 @@ | ||
def TestView(): | ||
def get(): | ||
return "Hello, world!" | ||
|
||
def post(request): | ||
body = bytes(request["body"]).decode("utf-8") | ||
print(body) | ||
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