diff options
author | Diego Elio Pettenò <flameeyes@flameeyes.eu> | 2013-08-10 23:24:41 +0200 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@flameeyes.eu> | 2013-08-10 23:24:41 +0200 |
commit | 234ccec69a6430e9468e42b55ff636163d86986e (patch) | |
tree | 4b33ad715027a5703943e1bc6334a2f37bffc922 /test | |
parent | glucometer: allow providing a freeform arbitrary date to set on the meter. (diff) | |
download | glucometerutils-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')
-rw-r--r-- | test/test_otultra2.py | 18 |
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) |