@@ -130,13 +130,13 @@ class TestAlarmDecoder(TestCase): | |||||
### Tests | ### Tests | ||||
def test_open(self): | def test_open(self): | ||||
self._decoder.open() | self._decoder.open() | ||||
self._device.open.assert_any_calls() | |||||
self._device.open.assert_any_call() | |||||
def test_close(self): | def test_close(self): | ||||
self._decoder.open() | self._decoder.open() | ||||
self._decoder.close() | self._decoder.close() | ||||
self._device.close.assert_any_calls() | |||||
self._device.close.assert_any_call() | |||||
def test_send(self): | def test_send(self): | ||||
self._decoder.send('test') | self._decoder.send('test') | ||||
@@ -148,7 +148,7 @@ class TestAlarmDecoder(TestCase): | |||||
def test_save_config(self): | def test_save_config(self): | ||||
self._decoder.save_config() | self._decoder.save_config() | ||||
self._device.write.assert_any_calls() | |||||
self._device.write.assert_any_call() | |||||
def test_reboot(self): | def test_reboot(self): | ||||
self._decoder.reboot() | self._decoder.reboot() | ||||
@@ -1,11 +1,6 @@ | |||||
from unittest import TestCase | from unittest import TestCase | ||||
from mock import Mock, MagicMock, patch | from mock import Mock, MagicMock, patch | ||||
from serial import Serial, SerialException | from serial import Serial, SerialException | ||||
try: | |||||
from pyftdi.pyftdi.ftdi import Ftdi, FtdiError | |||||
except: | |||||
from pyftdi.ftdi import Ftdi, FtdiError | |||||
from usb.core import USBError, Device as USBCoreDevice | |||||
import sys | import sys | ||||
import socket | import socket | ||||
import time | import time | ||||
@@ -120,7 +115,7 @@ class TestUSBDevice(TestCase): | |||||
with patch.object(self._device._device, 'open') as mock: | with patch.object(self._device._device, 'open') as mock: | ||||
self._device.open(no_reader_thread=True) | self._device.open(no_reader_thread=True) | ||||
mock.assert_any_calls() | |||||
mock.assert_any_call() | |||||
def test_open_failed(self): | def test_open_failed(self): | ||||
self._device.interface = 'AD2USB' | self._device.interface = 'AD2USB' | ||||
@@ -487,7 +482,7 @@ if have_pyftdi: | |||||
with patch.object(self._device._device, 'open') as mock: | with patch.object(self._device._device, 'open') as mock: | ||||
self._device.open(no_reader_thread=True) | self._device.open(no_reader_thread=True) | ||||
mock.assert_any_calls() | |||||
mock.assert_any_call() | |||||
def test_open_failed(self): | def test_open_failed(self): | ||||
self._device.interface = 'AD2USB' | self._device.interface = 'AD2USB' | ||||
@@ -73,7 +73,7 @@ class TestMessages(TestCase): | |||||
self.assertEqual(msg.event_type, 'ARM_STAY') | self.assertEqual(msg.event_type, 'ARM_STAY') | ||||
def test_lrr_message_parse_v2(self): | def test_lrr_message_parse_v2(self): | ||||
msg = LRRMessage(b'!LRR:001,1,CID_3401,ff') | |||||
msg = LRRMessage('!LRR:001,1,CID_3401,ff') | |||||
self.assertIsInstance(msg, LRRMessage) | self.assertIsInstance(msg, LRRMessage) | ||||
self.assertEquals(msg.event_data, '001') | self.assertEquals(msg.event_data, '001') | ||||
self.assertEquals(msg.partition, '1') | self.assertEquals(msg.partition, '1') | ||||
@@ -84,7 +84,7 @@ class TestMessages(TestCase): | |||||
self.assertEquals(msg.report_code, 'ff') | self.assertEquals(msg.report_code, 'ff') | ||||
def test_lrr_event_code_override(self): | def test_lrr_event_code_override(self): | ||||
msg = LRRMessage(b'!LRR:001,1,CID_3400,01') | |||||
msg = LRRMessage('!LRR:001,1,CID_3400,01') | |||||
self.assertEquals(msg.event_code, LRR_CID_EVENT.OPENCLOSE_BY_USER) # 400 -> 401 | self.assertEquals(msg.event_code, LRR_CID_EVENT.OPENCLOSE_BY_USER) # 400 -> 401 | ||||
def test_lrr_message_parse_fail(self): | def test_lrr_message_parse_fail(self): | ||||