def test_cannot_save_empty_city(self):
     list_ = List.objects.create()
     city = City()
     city.name = ''
     city.list = list_
     with self.assertRaises(ValidationError):
         city.save()
         city.full_clean()
Exemple #2
0
 def test_can_save_the_same_city_to_different_list(self):
     list_first = List.objects.create()
     list_second = List.objects.create()
     City.objects.create(name='City', list=list_first)
     city = City(name='City', list=list_second)
     city.full_clean()