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

Function test_setgetval

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

Source from the content-addressed store, hash-verified

380
381
382def test_setgetval():
383 v = view.View()
384 with taddons.context():
385 f = tflow.tflow()
386 v.add([f])
387 v.setvalue([f], "key", "value")
388 assert v.getvalue(f, "key", "default") == "value"
389 assert v.getvalue(f, "unknow", "default") == "default"
390
391 v.setvalue_toggle([f], "key")
392 assert v.getvalue(f, "key", "default") == "true"
393 v.setvalue_toggle([f], "key")
394 assert v.getvalue(f, "key", "default") == "false"
395
396 # Test with a different key name to verify the fix for hardcoded "key" bug
397 v.setvalue([f], "custom_setting", "true")
398 v.setvalue_toggle([f], "custom_setting")
399 assert v.getvalue(f, "custom_setting", "default") == "false"
400 v.setvalue_toggle([f], "custom_setting")
401 assert v.getvalue(f, "custom_setting", "default") == "true"
402
403
404def test_order():

Callers

nothing calls this directly

Calls 5

addMethod · 0.95
setvalueMethod · 0.95
getvalueMethod · 0.95
setvalue_toggleMethod · 0.95
contextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…