def test_update_employment(self):
"""
Test that we handle updating an employment correctly
"""
with mute_signals(post_save):
employment = EmploymentFactory.create()
employment_object = EmploymentSerializer(employment).data
employment_object['position'] = "SE"
serializer = ProfileSerializer(instance=employment.profile, data={
'work_history': [employment_object], 'education': []
})
serializer.is_valid(raise_exception=True)
serializer.save()
assert employment.profile.work_history.count() == 1
employment = employment.profile.work_history.first()
assert EmploymentSerializer(employment).data == employment_object
评论列表
文章目录