Exemple #1
0
 def setUp(self):
     tracer = Tracer(16)
     tracer.get_command_bytes = Mock(return_value=fixture_data)
     tracer.add_crc = Mock(return_value=fixture_data)
     tracer.verify_crc = Mock(return_value=True)
     tracer.get_result = Mock(return_value=Command(0x12, fixture_data))
     self.ts = TracerSerial(tracer, None)
Exemple #2
0
 def setUp(self):
     tracer = Tracer(16)
     tracer.get_command_bytes=Mock(return_value=fixture_data)
     tracer.add_crc = Mock(return_value=fixture_data)
     tracer.verify_crc = Mock(return_value=True)
     tracer.get_result = Mock(return_value=Command(0x12, fixture_data))
     self.ts = TracerSerial(tracer, None)
Exemple #3
0
class TestTracer(TestCase):
    def setUp(self):
        self.t = Tracer(16)

    def test_get_command_bytes(self):
        result = self.t.get_command_bytes(Command(0x12, fixture_data))
        self.assertEqual(bytearray(b'\x10\x12\x03' + fixture_data), result)

    def test_get_result(self):
        result = self.t.get_result(bytearray(b'\x00\xA0\x18') + query_result)
        self.assertEqual(QueryResult, type(result))
Exemple #4
0
class TestTracer(TestCase):
    def setUp(self):
        self.t = Tracer(16)

    def test_get_command_bytes(self):
        result = self.t.get_command_bytes(Command(0x12, fixture_data))
        self.assertEqual(bytearray(b'\x10\x12\x03' + fixture_data), result)

    def test_get_result(self):
        result = self.t.get_result(bytearray(b'\x00\xA0\x18') + query_result)
        self.assertEqual(QueryResult, type(result))