blob: cd879bfdaa78659de857d73f034030986e58f8d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import pytest
from mitmproxy.contentviews import base
def test_format_dict():
d = {"one": "two", "three": "four"}
f_d = base.format_dict(d)
assert next(f_d)
d = {"adsfa": ""}
f_d = base.format_dict(d)
assert next(f_d)
d = {}
f_d = base.format_dict(d)
with pytest.raises(StopIteration):
next(f_d)
def test_format_pairs():
d = [("a", "c"), ("b", "d")]
f_d = base.format_pairs(d)
assert next(f_d)
d = [("abc", "")]
f_d = base.format_pairs(d)
assert next(f_d)
d = []
f_d = base.format_pairs(d)
with pytest.raises(StopIteration):
next(f_d)
|