def testUnCreditoUnDebitoResultadoNoCero(self):
     billetera = BilleteraElectronica(1, 'sergio', 'barrios', 24101133, "8")
     deb = Debitos(5, "USB")
     cred = Creditos(7, "USB")
     billetera.Recargar(cred)
     billetera.Consumir(deb, "8")
     self.assertEqual(billetera.Saldo(), 2,
                      "No funciona calcular un credito y un debito")
 def testDebitoStringVacio(self):
     billetera = BilleteraElectronica(1024, 'Ramón', 'Nuñez', 237920, "8")
     cred = Creditos(1, "")
     billetera.Recargar(cred)
     deb = Debitos(1, "")
     billetera.Consumir(deb, "8")
     self.assertEqual(billetera.Saldo(), 0,
                      "Hay un error con entradas de string vacios")
 def testRecargaConsumoMinimo(self):
     billetera = BilleteraElectronica(12, 'sergio', 'barrios', 24101133,
                                      "8")
     cred = Creditos(0.01, "USB")
     deb = Debitos(0.01, "USB")
     billetera.Recargar(cred)
     billetera.Consumir(deb, "8")
     self.assertEqual(billetera.Saldo(), 0,
                      "No funciona la operacion minima")
 def testMegaRecargaMegaConsumo(self):
     billetera = BilleteraElectronica(2, 'francisco', 'sucre', 19564959,
                                      "142")
     deb = Debitos(2 ^ 31, "USB")
     cred = Creditos((2 ^ 31) + Decimal(0.01), "USB")
     billetera.Recargar(cred)
     billetera.Consumir(deb, "142")
     self.assertEqual(billetera.Saldo(),
                      Decimal(0.01).quantize(Decimal("1.00")),
                      "Existen Errores con la recarga/consumo grande")
 def testRecargaUnica(self):
     billetera = BilleteraElectronica(1, 'sergio', 'barrios', 24101133, "8")
     deb = Debitos(2, "USB")
     cred = Creditos(2, "USB")
     billetera.Recargar(cred)
     billetera.Consumir(deb, "8")
     recarga_nueva = Creditos(6, "USB")
     billetera.Recargar(recarga_nueva)
     self.assertEqual(billetera.Saldo(), 6,
                      "No funciona recargar un credito")
 def testConsumoUnicoConSuficienteCredito(self):
     billetera = BilleteraElectronica(1, 'sergio', 'barrios', 24101133, "8")
     deb = Debitos(2, "USB")
     cred = Creditos(9, "USB")
     billetera.Recargar(cred)
     billetera.Consumir(deb, "8")
     consumo_nuevo = Debitos(4, "USB")
     billetera.Consumir(consumo_nuevo, "8")
     self.assertEqual(
         billetera.Saldo(), 3,
         "No funciona consumir credito cuando se tiene suficiente")
 def testUnCreditoCuentaVacia(self):
     billetera = BilleteraElectronica(1, 'sergio', 'barrios', 24101133, "8")
     cred = Creditos(5, "USB")
     billetera.Recargar(cred)
     self.assertEqual(billetera.Saldo(), 5,
                      "No funciona calcular un solo credito")
 def testNombreCaracteresEspeciales(self):
     billetera = BilleteraElectronica(1024, 'Ramón', 'Nuñez', 3981023, "8")
     cred = Creditos(1, "USB")
     billetera.Recargar(cred)
     self.assertEqual(billetera.Saldo(), 1,
                      "No funcionan los caracteres especiales")