Ejemplo n.º 1
0
class ISO7816GeneratorTest(unittest.TestCase):

    card_type = 'iso7816'

    def setUp(self):
        self.card_generator = CardGenerator(self.card_type)

    def test_card_creation(self):
        self.card_generator.generateCard()
        mf, sam = self.card_generator.getCard()
        self.assertIsNotNone(mf)
        self.assertIsNotNone(sam)

    def test_get_and_set_card(self):
        self.card_generator.generateCard()
        mf, sam = self.card_generator.getCard()
        local_generator = CardGenerator(self.card_type)
        local_generator.setCard(mf, sam)
Ejemplo n.º 2
0
class ISO7816GeneratorTest(unittest.TestCase):

    card_type = 'iso7816'

    def setUp(self):
        self.card_generator = CardGenerator(self.card_type)

    def test_card_creation(self):
        self.card_generator.generateCard()
        mf, sam = self.card_generator.getCard()
        self.assertIsNotNone(mf)
        self.assertIsNotNone(sam)

    def test_get_and_set_card(self):
        self.card_generator.generateCard()
        mf, sam = self.card_generator.getCard()
        local_generator = CardGenerator(self.card_type)
        local_generator.setCard(mf, sam)
Ejemplo n.º 3
0
class ISO7816GeneratorTest(unittest.TestCase):

    card_type = 'iso7816'

    def setUp(self):
        self.filename = tempfile.mktemp()
        self.card_generator = CardGenerator(self.card_type)
        self.card_generator.password = "******"

    def test_card_creation(self):
        self.card_generator.generateCard()
        self.card_generator.saveCard(self.filename)
        mf, sam = self.card_generator.getCard()
        self.assertIsNotNone(mf)
        self.assertIsNotNone(sam)
        os.unlink(self.filename)

    def test_load_card_from_file(self):
        self.card_generator.generateCard()
        self.card_generator.saveCard(self.filename)
        local_generator = CardGenerator(self.card_type)
        local_generator.password = self.card_generator.password
        local_generator.loadCard(self.filename)
        mf, sam = local_generator.getCard()
        self.assertIsNotNone(mf)
        self.assertIsNotNone(sam)
        os.unlink(self.filename)

    def test_load_nonexistent_file(self):
        with self.assertRaises(anydbm.error):
            self.card_generator.loadCard(self.filename)

    def test_get_and_set_card(self):
        self.card_generator.generateCard()
        mf, sam = self.card_generator.getCard()
        local_generator = CardGenerator(self.card_type)
        local_generator.setCard(mf, sam)
Ejemplo n.º 4
0
class ISO7816GeneratorTest(unittest.TestCase):

    card_type = 'iso7816'

    def setUp(self):
        self.filename = tempfile.mktemp()
        self.card_generator = CardGenerator(self.card_type)
        self.card_generator.password = "******"

    def test_card_creation(self):
        self.card_generator.generateCard()
        self.card_generator.saveCard(self.filename)
        mf, sam = self.card_generator.getCard()
        self.assertIsNotNone(mf)
        self.assertIsNotNone(sam)
        os.unlink(self.filename)

    def test_load_card_from_file(self):
        self.card_generator.generateCard()
        self.card_generator.saveCard(self.filename)
        local_generator= CardGenerator(self.card_type)
        local_generator.password = self.card_generator.password
        local_generator.loadCard(self.filename)
        mf, sam = local_generator.getCard()
        self.assertIsNotNone(mf)
        self.assertIsNotNone(sam)
        os.unlink(self.filename)

    def test_load_nonexistent_file(self):
        with self.assertRaises(anydbm.error):
            self.card_generator.loadCard(self.filename)

    def test_get_and_set_card(self):
        self.card_generator.generateCard()
        mf, sam = self.card_generator.getCard()
        local_generator= CardGenerator(self.card_type)
        local_generator.setCard(mf, sam)