def test_validate_request_body_json(self): "Test validation of JSON request body" self.webhook.request_structure = "JSON" self.webhook.set("webhook_data", [{ "fieldname": "name", "key": "name" }]) self.webhook.webhook_json = """{ "name": "{{ doc.name }}" }""" self.webhook.save() self.assertEqual(self.webhook.webhook_data, []) data = get_webhook_data(doc=self.user, webhook=self.webhook) self.assertEqual(data, {"name": self.user.name})
def test_validate_request_body_form(self): "Test validation of Form URL-Encoded request body" self.webhook.request_structure = "Form URL-Encoded" self.webhook.set("webhook_data", [{ "fieldname": "name", "key": "name" }]) self.webhook.webhook_json = """{ "name": "{{ doc.name }}" }""" self.webhook.save() self.assertEqual(self.webhook.webhook_json, None) data = get_webhook_data(doc=self.user, webhook=self.webhook) self.assertEqual(data, {"name": self.user.name})