mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Add "add" ContentView method & test
This commit is contained in:
parent
f62d564cfb
commit
82a90511bc
@ -515,6 +515,14 @@ def get_by_shortcut(c):
|
|||||||
return i
|
return i
|
||||||
|
|
||||||
|
|
||||||
|
def add(obj):
|
||||||
|
for i in views:
|
||||||
|
if i.name == obj.name:
|
||||||
|
raise ContentViewException("Duplicate view: " + obj.name)
|
||||||
|
|
||||||
|
views.append(obj)
|
||||||
|
|
||||||
|
|
||||||
def get(name):
|
def get(name):
|
||||||
for i in views:
|
for i in views:
|
||||||
if i.name == name:
|
if i.name == name:
|
||||||
|
@ -210,6 +210,19 @@ Larry
|
|||||||
assert "decoded gzip" in r[0]
|
assert "decoded gzip" in r[0]
|
||||||
assert "Raw" in r[0]
|
assert "Raw" in r[0]
|
||||||
|
|
||||||
|
def test_add_cv(self):
|
||||||
|
class TestContentView(cv.View):
|
||||||
|
name = "test"
|
||||||
|
|
||||||
|
tcv = TestContentView()
|
||||||
|
cv.add(tcv)
|
||||||
|
|
||||||
|
tutils.raises(
|
||||||
|
ContentViewException,
|
||||||
|
cv.add,
|
||||||
|
tcv
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if pyamf:
|
if pyamf:
|
||||||
def test_view_amf_request():
|
def test_view_amf_request():
|
||||||
|
Loading…
Reference in New Issue
Block a user