예제 #1
0
def crearBilletera(cedul, cedulaTipo):
    form_data = {
        'nombre': 'Carlos',
        'apellido': 'Perez',
        'cedula': cedul,
        'PIN': '1234',
        'cedulaTipo': cedulaTipo
    }
    form = BilleteraForm(data = form_data)
    billetera = BilleteraElectronica.objects.all()
    
    if form.is_valid():
        if len(billetera) == 9999:
            pass
                
        #elif not BilleteraElectronica.objects.filter(cedula=form.cleaned_data['cedula']).exists():
        else:    
            obj = BilleteraElectronica(
                    nombre = form.cleaned_data['nombre'],
                    apellido = form.cleaned_data['apellido'],
                    PIN = form.cleaned_data['PIN'],
                    cedula = form.cleaned_data['cedula'],
                    saldo = 0.00,
                    cedulaTipo = form.cleaned_data['cedulaTipo']
                )
            
            try:
                with transaction.atomic():
                    obj.save()
            except (IntegrityError):
                pass 
예제 #2
0
def crearBilletera(cedul, cedulaTipo):
    form_data = {
        'nombre': 'Carlos',
        'apellido': 'Perez',
        'cedula': cedul,
        'PIN': '1234',
        'cedulaTipo': cedulaTipo
    }
    form = BilleteraForm(data=form_data)
    billetera = BilleteraElectronica.objects.all()

    if form.is_valid():
        if len(billetera) == 9999:
            pass

        #elif not BilleteraElectronica.objects.filter(cedula=form.cleaned_data['cedula']).exists():
        else:
            obj = BilleteraElectronica(
                nombre=form.cleaned_data['nombre'],
                apellido=form.cleaned_data['apellido'],
                PIN=form.cleaned_data['PIN'],
                cedula=form.cleaned_data['cedula'],
                saldo=0.00,
                cedulaTipo=form.cleaned_data['cedulaTipo'])

            try:
                with transaction.atomic():
                    obj.save()
            except (IntegrityError):
                pass
예제 #3
0
 def testCrearBilleteraForm_DosCampos(self):
     form_data = {
         'nombre': 'Neo',
         'apellido': 'Noria'
     }
     form = BilleteraForm(data = form_data)
     self.assertFalse(form.is_valid())
예제 #4
0
 def testCrearBilleteraForm_TresCampos(self):
     form_data = {
         'nombre': 'Carlos',
         'apellido': 'Perez',
         'cedula': '12345678'
     }
     form = BilleteraForm(data=form_data)
     self.assertFalse(form.is_valid())
예제 #5
0
 def testCrearBilleteraForm_TresCampos(self):
     form_data = {
         'nombre': 'Carlos',
         'apellido': 'Perez',
         'cedula': '12345678'
     }
     form = BilleteraForm(data = form_data)
     self.assertFalse(form.is_valid())
예제 #6
0
 def testCrearBilleteraForm_CincoCampos(self):
     form_data = {
         'nombre': 'Carlos',
         'apellido': 'Perez',
         'cedula': '12345678',
         'PIN': '1234',
         'cedulaTipo': 'V'
     }
     form = BilleteraForm(data=form_data)
     self.assertTrue(form.is_valid())
예제 #7
0
 def testCrearBilleteraForm_CincoCampos(self):
     form_data = {
         'nombre': 'Carlos',
         'apellido': 'Perez',
         'cedula': '12345678',
         'PIN': '1234',
         'cedulaTipo': 'V'
     }
     form = BilleteraForm(data = form_data)
     self.assertTrue(form.is_valid())
예제 #8
0
 def testBilleteraForm_CedulaLimiteInferior(self):
     form_data = {
         'nombre': 'Jose',
         'apellido': 'Perez Martinez',
         'cedula': '0',
         'cedulaTipo': 'V',
         'PIN': '1234',
         'identificador': '1000100010001000'
     }
     form = BilleteraForm(data=form_data)
     self.assertTrue(form.is_valid())
예제 #9
0
 def testBilleteraForm_NombreInvalidoSimbolos(self):
     form_data = {    
         'nombre': 'Jose .',
         'apellido': 'Perez',
         'cedula': '12345678',
         'cedulaTipo': 'V',
         'PIN': '1234',
         'identificador': '1000100010001000'
     }
     form = BilleteraForm(data = form_data)
     self.assertFalse(form.is_valid())
예제 #10
0
 def testBilleteraForm_NombreInvalidoSimbolos(self):
     form_data = {
         'nombre': 'Jose .',
         'apellido': 'Perez',
         'cedula': '12345678',
         'cedulaTipo': 'V',
         'PIN': '1234',
         'identificador': '1000100010001000'
     }
     form = BilleteraForm(data=form_data)
     self.assertFalse(form.is_valid())
예제 #11
0
 def testBilleteraForm_PINLimiteSuperior(self):
     form_data = {
         'nombre': 'Jose',
         'apellido': 'Perez Martinez',
         'cedula': '12345678',
         'cedulaTipo': 'V',
         'PIN': '9999',
         'identificador': '9999999999999999'
     }
     form = BilleteraForm(data=form_data)
     self.assertTrue(form.is_valid())
예제 #12
0
 def testBilleteraForm_PINInvalidoEspacio(self):
     form_data = {
         'nombre': 'Jose',
         'apellido': 'Perez Martinez',
         'cedula': '12345678',
         'cedulaTipo': 'V',
         'PIN': '12 34',
         'identificador': '9999999999999999'
     }
     form = BilleteraForm(data=form_data)
     self.assertFalse(form.is_valid())
예제 #13
0
 def testBilleteraForm_CedulaLimiteInferior(self):
     form_data = {    
         'nombre': 'Jose',
         'apellido': 'Perez Martinez',
         'cedula': '0',
         'cedulaTipo': 'V',
         'PIN': '1234',
         'identificador': '1000100010001000'
     }
     form = BilleteraForm(data = form_data)
     self.assertTrue(form.is_valid())
예제 #14
0
 def testBilleteraForm_ApellidoInvalidoDigitos(self):
     form_data = {
         'nombre': 'Jose',
         'apellido': 'Perez Martinez1',
         'cedula': '12345678',
         'cedulaTipo': 'V',
         'PIN': '1234',
         'identificador': '1000100010001000'
     }
     form = BilleteraForm(data=form_data)
     self.assertFalse(form.is_valid())
예제 #15
0
 def testBilleteraForm_ApellidoInvalidoDigitos(self):
     form_data = {    
         'nombre': 'Jose',
         'apellido': 'Perez Martinez1',
         'cedula': '12345678',
         'cedulaTipo': 'V',
         'PIN': '1234',
         'identificador': '1000100010001000'
     }
     form = BilleteraForm(data = form_data)
     self.assertFalse(form.is_valid())
예제 #16
0
 def testBilleteraForm_PINLimiteSuperior(self):
     form_data = {    
         'nombre': 'Jose',
         'apellido': 'Perez Martinez',
         'cedula': '12345678',
         'cedulaTipo': 'V',
         'PIN': '9999',
         'identificador': '9999999999999999'
     }
     form = BilleteraForm(data = form_data)
     self.assertTrue(form.is_valid())
예제 #17
0
 def testBilleteraForm_PINInvalidoEspacio(self):
     form_data = {    
         'nombre': 'Jose',
         'apellido': 'Perez Martinez',
         'cedula': '12345678',
         'cedulaTipo': 'V',
         'PIN': '12 34',
         'identificador': '9999999999999999'
     }
     form = BilleteraForm(data = form_data)
     self.assertFalse(form.is_valid())
예제 #18
0
 def testCrearBilleteraForm_UnCampo(self):
     form_data = {'nombre': 'Andrea'}
     form = BilleteraForm(data=form_data)
     self.assertFalse(form.is_valid())
예제 #19
0
 def testCrearBilleteraForm_DosCampos(self):
     form_data = {'nombre': 'Neo', 'apellido': 'Noria'}
     form = BilleteraForm(data=form_data)
     self.assertFalse(form.is_valid())
예제 #20
0
 def testCrearBilleteraForm_UnCampo(self):
     form_data = {
         'nombre': 'Andrea'
     }
     form = BilleteraForm(data = form_data)
     self.assertFalse(form.is_valid())
예제 #21
0
 def testCrearBilleteraForm_Vacio(self):
     form_data = {}
     form = BilleteraForm(data = form_data)
     self.assertFalse(form.is_valid())
예제 #22
0
 def testCrearBilleteraForm_Vacio(self):
     form_data = {}
     form = BilleteraForm(data=form_data)
     self.assertFalse(form.is_valid())