|
| 1 | +from django.test import TestCase |
| 2 | +from profiles.models import SportDoctor |
| 3 | + |
| 4 | + |
| 5 | +class SportDoctorModelTest(TestCase): |
| 6 | + @classmethod |
| 7 | + def setUpTestData(cls): |
| 8 | + """Create a valid instance of SportDoctor shared by all tests.""" |
| 9 | + cls.sport_doctor = SportDoctor.objects.create( |
| 10 | + first_name='Giovanni', |
| 11 | + last_name='Verdi', |
| 12 | + vat_number='12345678901' |
| 13 | + ) |
| 14 | + |
| 15 | + def test_sport_doctor_creation(self): |
| 16 | + """Test that a valid SportDoctor instance is created correctly.""" |
| 17 | + self.assertEqual(self.sport_doctor.first_name, 'Giovanni') |
| 18 | + self.assertEqual(self.sport_doctor.last_name, 'Verdi') |
| 19 | + self.assertEqual(self.sport_doctor.vat_number, '12345678901') |
| 20 | + |
| 21 | + def test_required_fields(self): |
| 22 | + """Test that required fields cannot be left blank.""" |
| 23 | + pass |
| 24 | + |
| 25 | + def test_vat_number_uniqueness(self): |
| 26 | + """Test that the vat_number field is unique.""" |
| 27 | + pass |
| 28 | + |
| 29 | + def test_vat_number_length(self): |
| 30 | + """Test that vat_number respects the max_length.""" |
| 31 | + pass |
| 32 | + |
| 33 | + def test_sport_doctor_string_representation(self): |
| 34 | + """Test __str__ method.""" |
| 35 | + self.assertEqual( |
| 36 | + str(self.sport_doctor), |
| 37 | + 'Giovanni Verdi - P.IVA: 12345678901' |
| 38 | + ) |
| 39 | + |
| 40 | + def test_sport_doctor_repr_representation(self): |
| 41 | + """Test __repr__ method.""" |
| 42 | + self.assertEqual( |
| 43 | + repr(self.sport_doctor), |
| 44 | + 'SportDoctor(first_name=Giovanni, last_name=Verdi, vat_number=12345678901)' |
| 45 | + ) |
| 46 | + |
| 47 | + def test_ordering(self): |
| 48 | + pass |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
0 commit comments