Пример #1
0
 def test_saving_oscar_no_error_throw(self):
     oscarAward = OscarAward(year=1979,
                             category=oscar_categories_tuple[0][0])
     oscarAward.full_clean()
     oscarAward.save()
     self.assertEqual(1, oscarAward.id)
     self.assertEqual(1979, oscarAward.year)
     self.assertEqual('Best_Film', oscarAward.category)
Пример #2
0
    def test_updating_category_throw_error(self):
        oscarAward = OscarAward(year=1979,
                                category=oscar_categories_tuple[0][0])
        oscarAward.full_clean()
        oscarAward.save()

        oscarAward.year = 'AA'
        with self.assertRaises(ValidationError):
            oscarAward.full_clean()
Пример #3
0
    def test_updating_category_no_validation_throw(self):
        oscarAward = OscarAward(year=1979,
                                category=oscar_categories_tuple[0][0])
        oscarAward.full_clean()
        oscarAward.save()

        oscarAward.category = oscar_categories_tuple[1][0]
        self.assertEqual(1, oscarAward.id)
        self.assertEqual(1979, oscarAward.year)
        self.assertEqual('Best_Film_Editing', oscarAward.category)
Пример #4
0
 def test_empty_award_should_throw_error(self):
     oscarAward = OscarAward()
     with self.assertRaises(ValidationError):
         oscarAward.full_clean()
Пример #5
0
 def test_future_year_should_throw_error(self):
     oscarAward = OscarAward(year=2030,
                             category=oscar_categories_tuple[0][0])
     with self.assertRaises(ValidationError):
         oscarAward.full_clean()
Пример #6
0
 def test_wrong_category_should_throw_error(self):
     oscarAward = OscarAward(category='AA')
     with self.assertRaises(ValidationError):
         oscarAward.full_clean()