I have a simple UpdateView which I want to test:
def test_valid(self):
response = self.client.post(self.path, {
'name': self.obj.name,
'country': self.obj.country,
'gender': self.obj.gender,
'about': self.obj.about,
'email': self.obj.email,
'city': 'new city name',
'zip': self.obj.zip,
})
self.assertEqual(response.status_code, 200)
self.obj.refresh_from_db()
self.assertEqual(self.obj.city, 'new city name')
How can I avoid to write all the values that I don't want to update again?
Aucun commentaire:
Enregistrer un commentaire