summaryrefslogtreecommitdiffstats
path: root/test/test_otultra2.py
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2013-08-10 23:24:41 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2013-08-10 23:24:41 +0200
commit234ccec69a6430e9468e42b55ff636163d86986e (patch)
tree4b33ad715027a5703943e1bc6334a2f37bffc922 /test/test_otultra2.py
parentglucometer: allow providing a freeform arbitrary date to set on the meter. (diff)
downloadglucometerutils-234ccec69a6430e9468e42b55ff636163d86986e.tar
glucometerutils-234ccec69a6430e9468e42b55ff636163d86986e.tar.gz
glucometerutils-234ccec69a6430e9468e42b55ff636163d86986e.tar.bz2
glucometerutils-234ccec69a6430e9468e42b55ff636163d86986e.tar.lz
glucometerutils-234ccec69a6430e9468e42b55ff636163d86986e.tar.xz
glucometerutils-234ccec69a6430e9468e42b55ff636163d86986e.tar.zst
glucometerutils-234ccec69a6430e9468e42b55ff636163d86986e.zip
Diffstat (limited to 'test/test_otultra2.py')
-rw-r--r--test/test_otultra2.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/test_otultra2.py b/test/test_otultra2.py
index 9080c79..5474c1f 100644
--- a/test/test_otultra2.py
+++ b/test/test_otultra2.py
@@ -28,41 +28,41 @@ class TestOTUltra2(unittest.TestCase):
self.device = otultra2.Device('mockdevice')
+ def _set_return_string(self, string):
+ self.mock_readline.return_value = bytes(string, 'ascii')
+
def testMissingChecksum(self):
- self.mock_readline.return_value = bytes('INVALID', 'ascii')
+ self._set_return_string('INVALID')
self.assertRaises(lifescan_common.MissingChecksum,
self.device.get_serial_number)
def testShortResponse(self):
- self.mock_readline.return_value = bytes('.\r', 'ascii')
+ self._set_return_string('.\r')
self.assertRaises(exceptions.InvalidResponse,
self.device.get_serial_number)
def testInvalidResponse(self):
- self.mock_readline.return_value = bytes('% 2500\r', 'ascii')
+ self._set_return_string('% 2500\r')
self.assertRaises(exceptions.InvalidResponse,
self.device.get_serial_number)
def testInvalidSerialNumber(self):
- self.mock_readline.return_value = bytes(
- '@ "12345678O" 0297\r', 'ascii')
+ self._set_return_string('@ "12345678O" 0297\r')
self.assertRaises(lifescan_common.InvalidSerialNumber,
self.device.get_serial_number)
def testInvalidChecksum(self):
- self.mock_readline.return_value = bytes(
- '% 1337\r', 'ascii')
+ self._set_return_string('% 1337\r')
self.assertRaises(lifescan_common.InvalidChecksum,
self.device.get_serial_number)
def testBrokenChecksum(self):
- self.mock_readline.return_value = bytes(
- '% 13AZ\r', 'ascii')
+ self._set_return_string('% 13AZ\r')
self.assertRaises(lifescan_common.MissingChecksum,
self.device.get_serial_number)