Skip to content
Snippets Groups Projects
Commit b9d64564 authored by Jean-Baptiste's avatar Jean-Baptiste
Browse files

update: Try to reproduce the error by completing a unit test case

parent 6ff20225
No related branches found
No related tags found
1 merge request!26Resolve "nested containers don't create the link with parents anymore"
Pipeline #740 passed with stage
in 1 minute and 25 seconds
...@@ -15,6 +15,7 @@ class Save(TestCase): ...@@ -15,6 +15,7 @@ class Save(TestCase):
"ldp:contains": [ "ldp:contains": [
{"@id": "https://happy-dev.fr/skills/{}/".format(skill1.pk)}, {"@id": "https://happy-dev.fr/skills/{}/".format(skill1.pk)},
{"@id": "https://happy-dev.fr/skills/{}/".format(skill2.pk), "title": "skill2 UP"}, {"@id": "https://happy-dev.fr/skills/{}/".format(skill2.pk), "title": "skill2 UP"},
{"title": "skill3 NEW", "obligatoire":"obligatoire"},
]} ]}
} }
...@@ -27,9 +28,10 @@ class Save(TestCase): ...@@ -27,9 +28,10 @@ class Save(TestCase):
result = serializer.save() result = serializer.save()
self.assertEquals(result.title, "job test") self.assertEquals(result.title, "job test")
self.assertIs(result.skills.count(), 2) self.assertIs(result.skills.count(), 3)
self.assertEquals(result.skills.all()[0].title, "skill1") # no change self.assertEquals(result.skills.all()[0].title, "skill1") # no change
self.assertEquals(result.skills.all()[1].title, "skill2 UP") # title updated self.assertEquals(result.skills.all()[1].title, "skill2 UP") # title updated
self.assertEquals(result.skills.all()[2].title, "skill3 NEW") # creation on the fly
def test_save_without_nested_fields(self): def test_save_without_nested_fields(self):
skill1 = Skill.objects.create(title="skill1", obligatoire="obligatoire") skill1 = Skill.objects.create(title="skill1", obligatoire="obligatoire")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment