holy fuking shit
This commit is contained in:
@@ -11,8 +11,8 @@ from referee import LocalSimulator, SimulatorClosed
|
||||
from referee.interface import handle_raw
|
||||
|
||||
|
||||
def payload(id="e", **extra):
|
||||
return dict(arena_id="default", robot_id="2026001", request_id=id, **extra)
|
||||
def payload(request_id="e", **extra):
|
||||
return dict(arena_id="default", robot_id="2026001", request_id=request_id, **extra)
|
||||
|
||||
|
||||
def post(sim, path, body=None, headers=None, method="POST", target=None):
|
||||
@@ -60,7 +60,8 @@ def test_raw_size_and_depth_boundaries_are_inclusive():
|
||||
("PUT", "/clear", None, 405),
|
||||
("POST", "/enter", [("Content-Type", "text/plain")], 415),
|
||||
("POST", "/enter", [("Content-Type", "application/json;foo=bar")], 415),
|
||||
("POST", "/enter", [("Content-Type", "application/json"), ("Content-Type", "application/json")], 415),
|
||||
("POST", "/enter",
|
||||
[("Content-Type", "application/json"), ("Content-Type", "application/json")], 415),
|
||||
("POST", "/enter", [("Content-Type", "application/json"), ("Content-Encoding", "gzip")], 415),
|
||||
("POST", "/enter", [("content-type", "Application/JSON; charset=UTF-8")], 200),
|
||||
("POST", "/enter", [("content-type", 'application/json;charset="utf-8"')], 200),
|
||||
@@ -84,7 +85,8 @@ def test_on_request_callback_receives_parsed_payload():
|
||||
seen = []
|
||||
raw = json.dumps(payload("enter-1")).encode()
|
||||
handle_raw(sim, "POST", "/enter", [("Content-Type", "application/json")], raw,
|
||||
on_request=lambda path, payload_dict, result: seen.append((path, payload_dict, result)))
|
||||
on_request=lambda path, payload_dict, result: seen.append(
|
||||
(path, payload_dict, result)))
|
||||
assert seen[0][0] == "/enter"
|
||||
assert seen[0][1]["request_id"] == "enter-1"
|
||||
assert seen[0][2].status == 200
|
||||
|
||||
Reference in New Issue
Block a user