From eefede927dd6261fc2c3040cc98ef2a1261b8f40 Mon Sep 17 00:00:00 2001 From: Scott Petersen Date: Sun, 21 Jan 2018 11:45:44 -0800 Subject: [PATCH] Updates to tests for Travis. --- test/test_ad2.py | 6 +++--- test/test_devices.py | 9 ++------- test/test_messages.py | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/test/test_ad2.py b/test/test_ad2.py index a357b3e..25e50f9 100644 --- a/test/test_ad2.py +++ b/test/test_ad2.py @@ -130,13 +130,13 @@ class TestAlarmDecoder(TestCase): ### Tests def test_open(self): self._decoder.open() - self._device.open.assert_any_calls() + self._device.open.assert_any_call() def test_close(self): self._decoder.open() self._decoder.close() - self._device.close.assert_any_calls() + self._device.close.assert_any_call() def test_send(self): self._decoder.send('test') @@ -148,7 +148,7 @@ class TestAlarmDecoder(TestCase): def test_save_config(self): self._decoder.save_config() - self._device.write.assert_any_calls() + self._device.write.assert_any_call() def test_reboot(self): self._decoder.reboot() diff --git a/test/test_devices.py b/test/test_devices.py index 604af8d..9038666 100644 --- a/test/test_devices.py +++ b/test/test_devices.py @@ -1,11 +1,6 @@ from unittest import TestCase from mock import Mock, MagicMock, patch 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 socket import time @@ -120,7 +115,7 @@ class TestUSBDevice(TestCase): with patch.object(self._device._device, 'open') as mock: self._device.open(no_reader_thread=True) - mock.assert_any_calls() + mock.assert_any_call() def test_open_failed(self): self._device.interface = 'AD2USB' @@ -487,7 +482,7 @@ if have_pyftdi: with patch.object(self._device._device, 'open') as mock: self._device.open(no_reader_thread=True) - mock.assert_any_calls() + mock.assert_any_call() def test_open_failed(self): self._device.interface = 'AD2USB' diff --git a/test/test_messages.py b/test/test_messages.py index 0da13c6..f3b0603 100644 --- a/test/test_messages.py +++ b/test/test_messages.py @@ -73,7 +73,7 @@ class TestMessages(TestCase): self.assertEqual(msg.event_type, 'ARM_STAY') 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.assertEquals(msg.event_data, '001') self.assertEquals(msg.partition, '1') @@ -84,7 +84,7 @@ class TestMessages(TestCase): self.assertEquals(msg.report_code, 'ff') 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 def test_lrr_message_parse_fail(self):