(transport)
| 251 | |
| 252 | |
| 253 | def test_send_headers(transport): |
| 254 | write = transport.write = mock.Mock() |
| 255 | |
| 256 | msg = protocol.Response(transport, 200) |
| 257 | msg.add_headers(('content-type', 'plain/html')) |
| 258 | assert not msg.is_headers_sent() |
| 259 | |
| 260 | msg.send_headers() |
| 261 | |
| 262 | content = b''.join([arg[1][0] for arg in list(write.mock_calls)]) |
| 263 | |
| 264 | assert content.startswith(b'HTTP/1.1 200 OK\r\n') |
| 265 | assert b'CONTENT-TYPE: plain/html' in content |
| 266 | assert msg.headers_sent |
| 267 | assert msg.is_headers_sent() |
| 268 | # cleanup |
| 269 | msg.writer.close() |
| 270 | |
| 271 | |
| 272 | def test_send_headers_non_ascii(transport): |
nothing calls this directly
no test coverage detected