| 222 | |
| 223 | |
| 224 | def test_dns(): |
| 225 | sio = io.StringIO() |
| 226 | d = dumper.Dumper(sio) |
| 227 | with taddons.context(d) as ctx: |
| 228 | ctx.configure(d, flow_detail=3, showhost=True) |
| 229 | |
| 230 | f = tflow.tdnsflow(resp=True) |
| 231 | d.dns_response(f) |
| 232 | assert "8.8.8.8" in sio.getvalue() |
| 233 | sio.truncate(0) |
| 234 | |
| 235 | f = tflow.tdnsflow() |
| 236 | f.response = f.request.fail(response_codes.NOTIMP) |
| 237 | d.dns_response(f) |
| 238 | assert "NOTIMP" in sio.getvalue() |
| 239 | sio.truncate(0) |
| 240 | |
| 241 | f = tflow.tdnsflow(err=True) |
| 242 | d.dns_error(f) |
| 243 | assert "error" in sio.getvalue() |
| 244 | |
| 245 | |
| 246 | def test_websocket(): |