def test_save_method(self): l = Location() l.defaultlocation = True l.name = 'HomeTest' l.save() _id = l.id l = Location() l.defaultlocation = True l.name = 'HomeTest' l.save() for l in Location.objects.exclude(id=l.id): self.assertFalse(l.defaultlocation, 'Should not be default location, only one is allowed')
def save_location(self): l = Location() l.defaultlocation = True l.name = 'HomeTest' l.save() self.assertIsNotNone(l.id, 'Location id is None') return l
def test_save_method(self): l = Location() l.defaultlocation = True l.name = 'HomeTest' l.save() _id = l.id l = Location() l.defaultlocation = True l.name = 'HomeTest' l.save() for l in Location.objects.exclude(id=l.id): self.assertFalse( l.defaultlocation, 'Should not be default location, only one is allowed')