예제 #1
0
    def testMalicia(self):
        miBilletera = BilleteraElectronica(1200, "Lautaro", "Villalon",
                                           "23.241.475", "0000")

        miBilletera.recarga(7321, "05/09/2017", 111)

        miBilletera.consumo(7321, "06/09/2017", 121, "1234")
예제 #2
0
    def testCasoEsquina1(self):
        miBilletera = BilleteraElectronica(1200, "Lautaro", "Villalón",
                                           "23.241.475", "0000")

        miBilletera.recarga(-3456, "10/05/2017", 121)

        miBilletera.consumo(4000, "11/05/2017", 131, "1234")
예제 #3
0
    def testCasoEsquina(self):
        miBilletera = BilleteraElectronica(1200, "Lautaro", "Villalón",
                                           "23.241.475", "0000")

        miBilletera.recarga(5000, "04/08/2017", 111)

        miBilletera.consumo(5001, "05/08/2017", 121, "0000")
예제 #4
0
    def testCasoFrontera(self):
        miBilletera = BilleteraElectronica(1200, "Lautaro", "Villalón",
                                           "23.241.475", "0000")

        miBilletera.recarga(7532, "17/10/2017", 111)

        miBilletera.consumo(3500, "17/10/2017", 121, "0000")
        miBilletera.consumo(4032, "18/10/2017", 122, "0000")
예제 #5
0
    def testCasoInterior(self):
        miBilletera = BilleteraElectronica(1200, "Lautaro", "Villalón",
                                           "23.241.475", "0000")

        miBilletera.recarga(5000, "04/08/2017", 111)
        miBilletera.recarga(5000, "05/08/2017", 111)

        miBilletera.consumo(9999, "15/09/2017", 2, "0000")
예제 #6
0
class Test(unittest.TestCase):

    # Se inicializa una instancia de BilleteraElectronica con la cual se van a
    #realizar los tests unitarios.
    def setUp(self):
        self.billetera = BilleteraElectronica(1, "julio", "fuenmayor",
                                              24818828, 1111)

    def testIdentificadorDeInstanciaValida(self):
        assert (self.billetera.validIdentifier()
                ), "Identificador de instancia invalido."

    def testNombreValido(self):
        assert (self.billetera.validName()), "Atributo nombre invalido."

    def testApellidoValido(self):
        assert (self.billetera.validSurname()), "Atributo apellido invalido."

    def testCIValida(self):
        assert (self.billetera.validID()), "Atributo CI invalido."

    def testPinValido(self):
        assert (self.billetera.validPin()), "Atributo PIN invalido."

    #Caso frontera
    def testSaldoCero(self):
        self.assertEquals(0, self.billetera.saldo())

    #Caso esquina
    def testRecargaEsquina1(self):
        recarga = Recarga(1, datetime.datetime.today())
        self.billetera.recargar(recarga)
        self.assertEquals(1, self.billetera.saldo())

    #Caso frontera
    def testRecargaFrontera(self):
        recarga = Recarga(float('inf'), datetime.datetime.today())
        self.billetera.recargar(recarga)
        self.assertEquals(float('inf'), self.billetera.saldo())

    #Caso esquina
    def testRecargaEsquina2(self):
        recarga = Recarga(float('inf') - 1, datetime.datetime.today())
        self.billetera.recargar(recarga)
        self.assertEquals(float('inf') - 1, self.billetera.saldo())

    #Caso interior
    def testRecargaPositiva(self):
        recarga = Recarga(1000, datetime.datetime.today())
        self.billetera.recargar(recarga)
        self.assertEquals(1000, self.billetera.saldo())

    #Caso malicioso
    def testRecargaNegativa(self):
        recarga = Recarga(-10, datetime.datetime.today())
        self.billetera.recargar(recarga)
        self.assertEquals("Monto de recarga invalido",
                          self.billetera.recargar(recarga))

    #Caso malicioso
    def testConsumoPinInvalido(self):
        recarga = Recarga(1000, datetime.datetime.today())
        self.billetera.recargar(recarga)
        transaccion = Transaccion(4, 500, datetime.datetime.today(), "Bodega")
        self.assertEquals("PIN invalido", self.billetera.consumo(transaccion))

    #Caso malicioso
    def testConsumoSaldoInsuficiente(self):
        recarga = Recarga(1000, datetime.datetime.today())
        self.billetera.recargar(recarga)
        transaccion = Transaccion(1111, 1001, datetime.datetime.today(),
                                  "Bodega")
        self.assertEquals("Saldo insuficiente",
                          self.billetera.consumo(transaccion))

    #Caso interior
    def testConsumoValido(self):
        recarga = Recarga(1000, datetime.datetime.today())
        self.billetera.recargar(recarga)
        transaccion = Transaccion(1111, 500, datetime.datetime.today(),
                                  "Bodega")
        self.billetera.consumo(transaccion)
        self.assertEquals(500, self.billetera.saldo())
예제 #7
0
    def testMalicia2(self):
        miBilletera = BilleteraElectronica(1200, "Lautaro", "Villalon",
                                           "23.241.475", "0000")

        miBilletera.consumo(-5, "08/10/2017", 111, "0000")