summaryrefslogtreecommitdiffstats
path: root/test/test_otultra2.py
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2013-08-03 22:28:43 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2013-08-03 22:28:43 +0200
commitf7fde8b5a659b5b7de7d00cddb28c20d3c691d37 (patch)
treee97fc56403c13ea8f21e6cb4243d50d83ae9bacd /test/test_otultra2.py
parentglucometer: remove unused argv usage. (diff)
downloadglucometerutils-f7fde8b5a659b5b7de7d00cddb28c20d3c691d37.tar
glucometerutils-f7fde8b5a659b5b7de7d00cddb28c20d3c691d37.tar.gz
glucometerutils-f7fde8b5a659b5b7de7d00cddb28c20d3c691d37.tar.bz2
glucometerutils-f7fde8b5a659b5b7de7d00cddb28c20d3c691d37.tar.lz
glucometerutils-f7fde8b5a659b5b7de7d00cddb28c20d3c691d37.tar.xz
glucometerutils-f7fde8b5a659b5b7de7d00cddb28c20d3c691d37.tar.zst
glucometerutils-f7fde8b5a659b5b7de7d00cddb28c20d3c691d37.zip
Diffstat (limited to 'test/test_otultra2.py')
-rw-r--r--test/test_otultra2.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/test_otultra2.py b/test/test_otultra2.py
index ba577c3..6ffea83 100644
--- a/test/test_otultra2.py
+++ b/test/test_otultra2.py
@@ -15,6 +15,7 @@ import mock
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from glucometerutils import common
+from glucometerutils.drivers import lifescan_common
from glucometerutils.drivers import otultra2
from glucometerutils import exceptions
@@ -30,7 +31,7 @@ class TestOTUltra2(unittest.TestCase):
def testMissingChecksum(self):
self.mock_readline.return_value = bytes('INVALID', 'ascii')
- self.assertRaises(otultra2.MissingChecksum,
+ self.assertRaises(lifescan_common.MissingChecksum,
self.device.get_serial_number)
def testShortResponse(self):
@@ -40,16 +41,30 @@ class TestOTUltra2(unittest.TestCase):
self.device.get_serial_number)
def testInvalidResponse(self):
- self.mock_readline.return_value = bytes('% 1337\r', 'ascii')
+ self.mock_readline.return_value = bytes('% 2500\r', 'ascii')
self.assertRaises(exceptions.InvalidResponse,
self.device.get_serial_number)
def testInvalidSerialNumber(self):
self.mock_readline.return_value = bytes(
- '@ "12345678O" 1337\r', 'ascii')
+ '@ "12345678O" E105\r', 'ascii')
- self.assertRaises(otultra2.InvalidSerialNumber,
+ self.assertRaises(lifescan_common.InvalidSerialNumber,
+ self.device.get_serial_number)
+
+ def testInvalidChecksum(self):
+ self.mock_readline.return_value = bytes(
+ '% 1337\r', 'ascii')
+
+ self.assertRaises(lifescan_common.InvalidChecksum,
+ self.device.get_serial_number)
+
+ def testBrokenChecksum(self):
+ self.mock_readline.return_value = bytes(
+ '% 13AZ\r', 'ascii')
+
+ self.assertRaises(lifescan_common.MissingChecksum,
self.device.get_serial_number)
if __name__ == '__main__':