Skip to content

Commit

Permalink
test_ATR: test get*() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
LudovicRousseau committed May 16, 2018
1 parent 6d4a9c5 commit 05625ca
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/test_ATR.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import unittest
from smartcard.ATR import ATR
from smartcard.Exceptions import SmartcardException
from smartcard.util import toBytes

if sys.version_info >= (3, 0):
from io import StringIO
Expand Down Expand Up @@ -155,5 +156,16 @@ def test_ATR_TS(self):
print(the_exception)
self.assertEqual(str(the_exception), "invalid TS 0x42")

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)

if __name__ == '__main__':
unittest.main(buffer=True)

0 comments on commit 05625ca

Please sign in to comment.