Skip to content

Commit

Permalink
Agrego el test unitario para validar que el campo telefono sea numerico
Browse files Browse the repository at this point in the history
  • Loading branch information
felygl77 committed Jun 28, 2024
1 parent a52ea3a commit 403f713
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/tests_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,21 @@ def test_phone_number_without_54(self):
self.assertIn("phone", errors)
self.assertEqual(errors["phone"], "El telefono debe comenzar con 54")

def test_phone_number_with_a_letter(self):
"""
La funcion verifica que el campo solo tengo caracteres numericos
"""
client_data = {
"name": "Juan Sebastian Veron",
"phone": "a2245556789",
"city": "La Plata",
"email": "[email protected]",
}
errors = validate_client(client_data)
self.assertIn("phone", errors)
self.assertEqual(errors["phone"], "El teléfono solo debe contener números")

class MedicineModelTest(TestCase):
"""
Pruebas para el modelo Medicina.
Expand Down

0 comments on commit 403f713

Please sign in to comment.