update test file

This commit is contained in:
Fanani M. Ihsan 2018-12-27 15:15:23 +07:00
parent 2a92b9e50c
commit e376bc8df8

View File

@ -69,7 +69,7 @@ class PYZKTest(unittest.TestCase):
helper.return_value.test_tcp.return_value = 1 # helper tcp ok helper.return_value.test_tcp.return_value = 1 # helper tcp ok
socket.return_value.recv.return_value = b'' socket.return_value.recv.return_value = b''
#begin #begin
zk = ZK('192.168.1.201') zk = ZK('192.168.1.201', force_udp=True)
helper.assert_called_with('192.168.1.201', 4370) # called correctly helper.assert_called_with('192.168.1.201', 4370) # called correctly
self.assertRaisesRegex(ZKNetworkError, "unpack requires", zk.connect) # no data...? self.assertRaisesRegex(ZKNetworkError, "unpack requires", zk.connect) # no data...?
@ -121,7 +121,7 @@ class PYZKTest(unittest.TestCase):
helper.return_value.test_tcp.return_value = 1 # helper tcp nope helper.return_value.test_tcp.return_value = 1 # helper tcp nope
socket.return_value.recv.return_value = codecs.decode('d007fffc2ffb0000','hex') # tcp CMD_ACK_OK socket.return_value.recv.return_value = codecs.decode('d007fffc2ffb0000','hex') # tcp CMD_ACK_OK
#begin #begin
zk = ZK('192.168.1.201') zk = ZK('192.168.1.201', force_udp=True)
conn = zk.connect() conn = zk.connect()
socket.return_value.sendto.assert_called_with(codecs.decode('e80317fc00000000', 'hex'), ('192.168.1.201', 4370)) socket.return_value.sendto.assert_called_with(codecs.decode('e80317fc00000000', 'hex'), ('192.168.1.201', 4370))
conn.disconnect() conn.disconnect()