mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Add unit test on datagram_received when bad signature is happening
This commit is contained in:
parent
fe26b59308
commit
84fc332817
@ -179,3 +179,20 @@ class SSDPFactoryTestCase(TestCase):
|
||||
assert ssdp.time.sleep.call_args[0][0] > 0 and ssdp.time.sleep.call_args[0][0] < 0.5
|
||||
assert factory.log.debug.called
|
||||
assert 'Permission error' in factory.log.debug.mock_calls[0][1][0]
|
||||
|
||||
def test_datagram_received_bad_signature(self):
|
||||
'''
|
||||
Test datagram_received on bad signature
|
||||
|
||||
:return:
|
||||
'''
|
||||
factory = ssdp.SSDPFactory()
|
||||
data = 'nonsense'
|
||||
addr = '10.10.10.10', 'foo.suse.de'
|
||||
|
||||
with patch.object(factory, 'log', MagicMock()):
|
||||
factory.datagram_received(data=data, addr=addr)
|
||||
assert factory.log.debug.called
|
||||
assert 'Received bad signature from' in factory.log.debug.call_args[0][0]
|
||||
assert factory.log.debug.call_args[0][1] == addr[0]
|
||||
assert factory.log.debug.call_args[0][2] == addr[1]
|
||||
|
Loading…
Reference in New Issue
Block a user