Skip to content

Commit

Permalink
✨ Apply new feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Oct 27, 2023
1 parent 02b6724 commit 0126143
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/openforms/forms/tests/test_api_formsteps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,25 +1095,19 @@ def test_update_with_translations_validate_literals(self, _mock):


class FormStepsAPIApplicabilityTests(APITestCase):
def setUp(self):
super().setUp()

self.user = UserFactory.create()
self.form = FormFactory.create()
self.form_definition = FormDefinitionFactory.create()
self.client.force_authenticate(user=self.user)

def test_create_form_step_not_applicable_as_first_unsucessful(self):
self.user.user_permissions.add(Permission.objects.get(codename="change_form"))
self.user.is_staff = True
self.user.save()
url = reverse(
"api:form-steps-list", kwargs={"form_uuid_or_slug": self.form.uuid}
)
user = UserFactory.create()
form = FormFactory.create()
form_definition = FormDefinitionFactory.create()
self.client.force_authenticate(user=user)
user.user_permissions.add(Permission.objects.get(codename="change_form"))
user.is_staff = True
user.save()
url = reverse("api:form-steps-list", kwargs={"form_uuid_or_slug": form.uuid})

form_detail_url = reverse(
"api:formdefinition-detail",
kwargs={"uuid": self.form_definition.uuid},
kwargs={"uuid": form_definition.uuid},
)
data = {
"formDefinition": f"http://testserver{form_detail_url}",
Expand All @@ -1131,3 +1125,12 @@ def test_create_form_step_not_applicable_as_first_unsucessful(self):
"reason": "First form step must be applicable.",
},
)

data = {
"formDefinition": f"http://testserver{form_detail_url}",
"index": 0,
"isApplicable": True,
}
response = self.client.post(url, data=data)

self.assertEqual(response.status_code, status.HTTP_201_CREATED)

0 comments on commit 0126143

Please sign in to comment.