[dns] eventsequence test
This commit is contained in:
parent
fc0bdc143c
commit
c504bc6eb1
|
@ -59,6 +59,22 @@ def test_tcp_flow(err):
|
|||
assert isinstance(next(i), layers.tcp.TcpEndHook)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("resp, err", [
|
||||
(False, False),
|
||||
(True, False),
|
||||
(False, True),
|
||||
(True, True),
|
||||
])
|
||||
def test_dns(resp, err):
|
||||
f = tflow.tdnsflow(resp=resp, err=err)
|
||||
i = eventsequence.iterate(f)
|
||||
assert isinstance(next(i), layers.dns.DnsRequestHook)
|
||||
if resp:
|
||||
assert isinstance(next(i), layers.dns.DnsResponseHook)
|
||||
if err:
|
||||
assert isinstance(next(i), layers.dns.DnsErrorHook)
|
||||
|
||||
|
||||
def test_invalid():
|
||||
with pytest.raises(TypeError):
|
||||
next(eventsequence.iterate(42))
|
||||
|
|
Loading…
Reference in New Issue