MCPcopy
hub / github.com/aio-libs/aiohttp / test_HTTPMethodNotAllowed

Function test_HTTPMethodNotAllowed

tests/test_web_exceptions.py:111–125  ·  view source on GitHub ↗
(buf, request)

Source from the content-addressed store, hash-verified

109
110@pytest.mark.run_loop
111def test_HTTPMethodNotAllowed(buf, request):
112 resp = web.HTTPMethodNotAllowed('get', ['POST', 'PUT'])
113 assert 'GET' == resp.method
114 assert ['POST', 'PUT'] == resp.allowed_methods
115 assert 'POST,PUT' == resp.headers['allow']
116 yield from resp.prepare(request)
117 yield from resp.write_eof()
118 txt = buf.decode('utf8')
119 assert re.match('HTTP/1.1 405 Method Not Allowed\r\n'
120 'CONTENT-TYPE: text/plain; charset=utf-8\r\n'
121 'CONTENT-LENGTH: 23\r\n'
122 'ALLOW: POST,PUT\r\n'
123 'DATE: .+\r\n'
124 'SERVER: .+\r\n\r\n'
125 '405: Method Not Allowed', txt)
126
127
128def test_override_body_with_text():

Callers

nothing calls this directly

Calls 4

decodeMethod · 0.80
prepareMethod · 0.45
write_eofMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected