def test_ATR_get(self): atr = "3B F2 95 12 34 01 36 06" a = ATR(toBytes(atr)) self.assertEqual(a.getTA1(), 0x95) self.assertEqual(a.getTB1(), 0x12) self.assertEqual(a.getTC1(), 0x34) self.assertEqual(a.getTD1(), 0x01) self.assertEqual(a.getHistoricalBytes(), [0x36, 0x06]) self.assertFalse(a.isT15Supported()) self.assertEqual(str(a), atr)
def testcase_ATR7(self): """Protect V3 T=1""" a = ATR([0x3B, 0xE5, 0x00, 0x00, 0x81, 0x21, 0x45, 0x9C, 0x10, 0x01, 0x00, 0x80, 0x0D]) historicalbytes = [0x9C, 0x10, 0x01, 0x00, 0x80] self.assertEqual(a.getHistoricalBytes(), historicalbytes) self.assertEqual(a.getChecksum(), 0x0D) self.assertTrue(not a.isT0Supported()) self.assertTrue(a.isT1Supported()) self.assertTrue(not a.isT15Supported()) self.assertTrue(a.checksumOK) self.assertTrue(a.getTB1() == 0x00) self.assertTrue(a.getTC1() == 0x00) self.assertTrue(a.getTD1() == 0x81) self.assertTrue(a.TD[2 - 1] == 0x21) # TD2 self.assertTrue(a.TB[3 - 1] == 0x45) # TB3
def testcase_ATR7(self): """Protect V3 T=1""" a = ATR([0x3B, 0xE5, 0x00, 0x00, 0x81, 0x21, 0x45, 0x9C, 0x10, 0x01, 0x00, 0x80, 0x0D]) historicalbytes = [0x9C, 0x10, 0x01, 0x00, 0x80] self.assertEquals(a.getHistoricalBytes(), historicalbytes) self.assertEquals(a.getChecksum(), 0x0D) self.assert_(not a.isT0Supported()) self.assert_(a.isT1Supported()) self.assert_(not a.isT15Supported()) self.assert_(a.checksumOK) self.assert_(a.getTB1() == 0x00) self.assert_(a.getTC1() == 0x00) self.assert_(a.getTD1() == 0x81) self.assert_(a.TD[2 - 1] == 0x21) # TD2 self.assert_(a.TB[3 - 1] == 0x45) # TB3