Integration test: Make sure that the runtime hooks are triggered on startup in the correct order.
(tdata, capsys)
| 317 | |
| 318 | |
| 319 | def test_order(tdata, capsys): |
| 320 | """Integration test: Make sure that the runtime hooks are triggered on startup in the correct order.""" |
| 321 | main.mitmdump( |
| 322 | [ |
| 323 | "-n", |
| 324 | "-s", |
| 325 | tdata.path("mitmproxy/data/addonscripts/recorder/recorder.py"), |
| 326 | "-s", |
| 327 | tdata.path("mitmproxy/data/addonscripts/shutdown.py"), |
| 328 | ] |
| 329 | ) |
| 330 | time = r"\[[\d:.]+\] " |
| 331 | out = capsys.readouterr().out |
| 332 | assert re.match( |
| 333 | rf"{time}Loading script.+recorder.py\n" |
| 334 | rf"{time}\('recorder', 'load', .+\n" |
| 335 | rf"{time}\('recorder', 'configure', .+\n" |
| 336 | rf"{time}Loading script.+shutdown.py\n" |
| 337 | rf"{time}\('recorder', 'running', .+\n" |
| 338 | rf"{time}\('recorder', 'done', .+\n$", |
| 339 | out, |
| 340 | ) |