Exemplo n.º 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()
Exemplo n.º 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)
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 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)