Clean up use cases:
This commit is contained in:
@@ -210,12 +210,12 @@ def test_bp_with_host(app):
|
||||
app.blueprint(bp)
|
||||
headers = {"Host": "example.com"}
|
||||
request, response = app.test_client.get("/test1/", headers=headers)
|
||||
assert response.text == "Hello"
|
||||
assert response.body == b"Hello"
|
||||
|
||||
headers = {"Host": "sub.example.com"}
|
||||
request, response = app.test_client.get("/test1/", headers=headers)
|
||||
|
||||
assert response.text == "Hello subdomain!"
|
||||
print(app.router.find_route_src)
|
||||
assert response.body == b"Hello subdomain!"
|
||||
|
||||
|
||||
def test_several_bp_with_host(app):
|
||||
@@ -240,6 +240,7 @@ def test_several_bp_with_host(app):
|
||||
assert bp.host == "example.com"
|
||||
headers = {"Host": "example.com"}
|
||||
request, response = app.test_client.get("/test/", headers=headers)
|
||||
|
||||
assert response.text == "Hello"
|
||||
|
||||
assert bp2.host == "sub.example.com"
|
||||
@@ -537,19 +538,19 @@ def test_bp_shorthand(app):
|
||||
app.blueprint(blueprint)
|
||||
|
||||
request, response = app.test_client.get("/get")
|
||||
assert response.text == "OK"
|
||||
assert response.body == b"OK"
|
||||
|
||||
request, response = app.test_client.post("/get")
|
||||
assert response.status == 405
|
||||
|
||||
request, response = app.test_client.put("/put")
|
||||
assert response.text == "OK"
|
||||
assert response.body == b"OK"
|
||||
|
||||
request, response = app.test_client.get("/post")
|
||||
assert response.status == 405
|
||||
|
||||
request, response = app.test_client.post("/post")
|
||||
assert response.text == "OK"
|
||||
assert response.body == b"OK"
|
||||
|
||||
request, response = app.test_client.get("/post")
|
||||
assert response.status == 405
|
||||
@@ -561,19 +562,19 @@ def test_bp_shorthand(app):
|
||||
assert response.status == 405
|
||||
|
||||
request, response = app.test_client.options("/options")
|
||||
assert response.text == "OK"
|
||||
assert response.body == b"OK"
|
||||
|
||||
request, response = app.test_client.get("/options")
|
||||
assert response.status == 405
|
||||
|
||||
request, response = app.test_client.patch("/patch")
|
||||
assert response.text == "OK"
|
||||
assert response.body == b"OK"
|
||||
|
||||
request, response = app.test_client.get("/patch")
|
||||
assert response.status == 405
|
||||
|
||||
request, response = app.test_client.delete("/delete")
|
||||
assert response.text == "OK"
|
||||
assert response.body == b"OK"
|
||||
|
||||
request, response = app.test_client.get("/delete")
|
||||
assert response.status == 405
|
||||
|
||||
@@ -43,7 +43,7 @@ async def test_cookies_asgi(app):
|
||||
response_cookies = SimpleCookie()
|
||||
response_cookies.load(response.headers.get("set-cookie", {}))
|
||||
|
||||
assert response.text == "Cookies are: working!"
|
||||
assert response.body == b"Cookies are: working!"
|
||||
assert response_cookies["right_back"].value == "at you"
|
||||
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@ def test_unexisting_methods(app):
|
||||
|
||||
app.add_route(DummyView.as_view(), "/")
|
||||
request, response = app.test_client.get("/")
|
||||
assert response.text == "I am get method"
|
||||
assert response.body == b"I am get method"
|
||||
request, response = app.test_client.post("/")
|
||||
assert "Method POST not allowed for URL /" in response.text
|
||||
assert b"Method POST not allowed for URL /" in response.body
|
||||
|
||||
|
||||
def test_argument_methods(app):
|
||||
|
||||
Reference in New Issue
Block a user