MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / test_order

Function test_order

test/mitmproxy/addons/test_view.py:404–425  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

402
403
404def test_order():
405 v = view.View()
406 v.requestheaders(tft(method="get", start=1))
407 v.requestheaders(tft(method="put", start=2))
408 v.requestheaders(tft(method="get", start=3))
409 v.requestheaders(tft(method="put", start=4))
410 assert [i.timestamp_created for i in v] == [1, 2, 3, 4]
411
412 v.set_order("method")
413 assert v.get_order() == "method"
414 assert [i.request.method for i in v] == ["GET", "GET", "PUT", "PUT"]
415 v.set_reversed(True)
416 assert [i.request.method for i in v] == ["PUT", "PUT", "GET", "GET"]
417
418 v.set_order("time")
419 assert v.get_order() == "time"
420 assert [i.timestamp_created for i in v] == [4, 3, 2, 1]
421
422 v.set_reversed(False)
423 assert [i.timestamp_created for i in v] == [1, 2, 3, 4]
424 with pytest.raises(exceptions.CommandError):
425 v.set_order("not_an_order")
426
427
428def test_reversed():

Callers

nothing calls this directly

Calls 5

requestheadersMethod · 0.95
set_orderMethod · 0.95
get_orderMethod · 0.95
set_reversedMethod · 0.95
tftFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…