def test_form_edit_normal(self): app.current_request.json_body = { "name": "New name", "schema": { "new": "schema" } } form_edit(self.formId) form = Form.objects.get({"_id": self.formId}) self.assertEqual(form.name, "New name") self.assertEqual(form.schema, {"new": "schema"})
def test_form_edit_special_chars(self): app.current_request.json_body = { "name": "New name", "schema": { "$ref": "schema" }, "formOptions": { "dataOptions": { "views": [{ "a": { "$ref": "hi", "a.b.c": "hu" } }] } }, } form_edit(self.formId) form = Form.objects.get({"_id": self.formId}) self.assertEqual(form.name, "New name") self.assertEqual(form.schema, {"__$ref": "schema"}) self.assertEqual( form.formOptions.dataOptions["views"][0], {"a": { "|ref": "hi", "a||b||c": "hu" }}, ) response = form_render(self.formId) form = response["res"] self.assertEqual(form["name"], "New name") self.assertEqual(form["schema"], {"$ref": "schema"}) self.assertEqual( form["formOptions"]["dataOptions"]["views"][0], {"a": { "$ref": "hi", "a.b.c": "hu" }}, )
def test_form_edit_tags(self): app.current_request.json_body = {"tags": ["a", "b", "c"]} form_edit(self.formId) form = Form.objects.get({"_id": self.formId}) self.assertEqual(form.tags, ["a", "b", "c"])