예제 #1
0
 def test_createProfile_whenValidEgn_shouldCreate(self):
     name = 'Doncho'
     age = 19
     egn = '1234567890'
     profile = Profile(name=name, age=age, egn=egn)
     profile.full_clean()
     profile.save()
예제 #2
0
    def test_createProfile_whenEgnContainsLetters_shouldRaise(self):
        name = 'Doncho'
        age = 19
        egn = '12345678a0'
        with self.assertRaises(ValidationError) as context:
            profile = Profile(name=name, age=age, egn=egn)
            profile.full_clean()
            profile.save()

        self.assertIsNotNone(context.exception)
예제 #3
0
 def test_createProfile_whenValidEgn_shouldCreate(self):
     name = 'Georgi'
     age = 21
     egn = '1234567890'
     profile = Profile(
         name=name,
         age=age,
         egn=egn,
     )
     profile.full_clean()
     profile.save()
예제 #4
0
    def test_create_profile_whenValidEgn_shouldCreateTheProfile(self):
        name = 'liusska'
        age = 19
        egn = '1234567890'
        profile = Profile(
            name=name,
            age=age,
            egn=egn
        )

        profile.save()
예제 #5
0
    def test_createProfile_whenInValidEgn_shouldRaise(self):
        name = 'Georgi'
        age = 21
        egn = '123456789a'
        with self.assertRaises(ValidationError) as context:
            profile = Profile(
                name=name,
                age=age,
                egn=egn,
            )
            profile.full_clean()
            profile.save()

        self.assertIsNotNone(context)