|
49 | 49 | "{{image_data}}", str(base64.b64encode(open(PICTURE, "rb").read())) |
50 | 50 | ) |
51 | 51 |
|
52 | | -FORM_RECEIVE_MESSAGES = [ |
53 | | - {"type": "http.request", "body": BODY_FORM.encode("utf-8")}, |
54 | | - {"type": "http.disconnect"}, |
55 | | -] |
56 | | - |
57 | | -JSON_RECEIVE_MESSAGES = [ |
58 | | - {"type": "http.request", "body": json.dumps(BODY_JSON).encode("utf-8")}, |
59 | | - {"type": "http.disconnect"}, |
60 | | -] |
61 | | - |
62 | 52 | PARSED_FORM = starlette.datastructures.FormData( |
63 | 53 | [ |
64 | 54 | ("username", "Jane"), |
|
73 | 63 | ] |
74 | 64 | ) |
75 | 65 |
|
76 | | -# Dummy ASGI scope for creating mock Starlette requests |
77 | | -SCOPE = { |
78 | | - "client": ("172.29.0.10", 34784), |
79 | | - "headers": [ |
80 | | - [b"host", b"example.com"], |
81 | | - [b"user-agent", b"Mozilla/5.0 Gecko/20100101 Firefox/60.0"], |
82 | | - [b"content-type", b"application/json"], |
83 | | - [b"accept-language", b"en-US,en;q=0.5"], |
84 | | - [b"accept-encoding", b"gzip, deflate, br"], |
85 | | - [b"upgrade-insecure-requests", b"1"], |
86 | | - [b"cookie", b"yummy_cookie=choco; tasty_cookie=strawberry"], |
87 | | - ], |
88 | | - "http_version": "0.0", |
89 | | - "method": "GET", |
90 | | - "path": "/path", |
91 | | - "query_string": b"qs=hello", |
92 | | - "scheme": "http", |
93 | | - "server": ("172.28.0.10", 8000), |
94 | | - "type": "http", |
95 | | -} |
96 | | - |
97 | 66 |
|
98 | 67 | async def _mock_receive(msg): |
99 | 68 | return msg |
|
0 commit comments