-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74d3b3b
commit dc7d7d3
Showing
6 changed files
with
176 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...s/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_multiple_file_uploads.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
interactions: | ||
- request: | ||
body: '{"values": {"file": [{"file_name": "file1.txt", "content": "VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu"}, | ||
{"file_name": "file2.txt", "content": "Q29udGVudCBleGFtcGxlIGlzIHRoaXMu"}]}, | ||
"schema": {"$schema": "https://json-schema.org/draft/2020-12/schema", "type": | ||
"object", "properties": {"static_var_1": {"type": "string", "pattern": "^cool_pattern$"}, | ||
"form_var_1": {"type": "string"}, "form_var_2": {"type": "string"}, "attachment": | ||
{"type": "string", "contentEncoding": "base64"}}, "required": ["static_var_1", | ||
"form_var_1", "form_var_2"], "additionalProperties": false}}' | ||
headers: | ||
Accept: | ||
- '*/*' | ||
Accept-Encoding: | ||
- gzip, deflate, br | ||
Authorization: | ||
- Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzcwMzM3OTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.ZE3A4AQZ8omE_KsvI_LcDSMrmBa9-AJoUiiAdjhtSqo | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '562' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- python-requests/2.32.2 | ||
method: POST | ||
uri: http://localhost/json_plugin | ||
response: | ||
body: | ||
string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n | ||
\ \"additionalProperties\": false,\n \"properties\": {\n \"attachment\": | ||
{\n \"contentEncoding\": \"base64\",\n \"type\": \"string\"\n | ||
\ },\n \"form_var_1\": {\n \"type\": \"string\"\n },\n | ||
\ \"form_var_2\": {\n \"type\": \"string\"\n },\n \"static_var_1\": | ||
{\n \"pattern\": \"^cool_pattern$\",\n \"type\": \"string\"\n | ||
\ }\n },\n \"required\": [\n \"static_var_1\",\n \"form_var_1\",\n | ||
\ \"form_var_2\"\n ],\n \"type\": \"object\"\n },\n \"values\": | ||
{\n \"file\": [\n {\n \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n | ||
\ \"file_name\": \"file1.txt\"\n },\n {\n \"content\": | ||
\"Q29udGVudCBleGFtcGxlIGlzIHRoaXMu\",\n \"file_name\": \"file2.txt\"\n | ||
\ }\n ]\n }\n },\n \"message\": \"Data received\"\n}\n" | ||
headers: | ||
Connection: | ||
- close | ||
Content-Length: | ||
- '923' | ||
Content-Type: | ||
- application/json | ||
Date: | ||
- Thu, 16 Jan 2025 13:23:17 GMT | ||
Server: | ||
- Werkzeug/3.1.3 Python/3.12.8 | ||
status: | ||
code: 201 | ||
message: CREATED | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...s/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_submission_happy_flow.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
interactions: | ||
- request: | ||
body: '{"values": {"auth_bsn": "123456789", "firstName": "We Are", "file": {"file_name": | ||
"test_file.txt", "content": "VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu"}}, "schema": | ||
{"$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", | ||
"properties": {"static_var_1": {"type": "string", "pattern": "^cool_pattern$"}, | ||
"form_var_1": {"type": "string"}, "form_var_2": {"type": "string"}, "attachment": | ||
{"type": "string", "contentEncoding": "base64"}}, "required": ["static_var_1", | ||
"form_var_1", "form_var_2"], "additionalProperties": false}}' | ||
headers: | ||
Accept: | ||
- '*/*' | ||
Accept-Encoding: | ||
- gzip, deflate, br | ||
Authorization: | ||
- Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzcwMzM3OTgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.auRLR2g7eX3HTcKYX6vM2j4WThn9rWImicoRL1rz0l4 | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '537' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- python-requests/2.32.2 | ||
method: POST | ||
uri: http://localhost/json_plugin | ||
response: | ||
body: | ||
string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n | ||
\ \"additionalProperties\": false,\n \"properties\": {\n \"attachment\": | ||
{\n \"contentEncoding\": \"base64\",\n \"type\": \"string\"\n | ||
\ },\n \"form_var_1\": {\n \"type\": \"string\"\n },\n | ||
\ \"form_var_2\": {\n \"type\": \"string\"\n },\n \"static_var_1\": | ||
{\n \"pattern\": \"^cool_pattern$\",\n \"type\": \"string\"\n | ||
\ }\n },\n \"required\": [\n \"static_var_1\",\n \"form_var_1\",\n | ||
\ \"form_var_2\"\n ],\n \"type\": \"object\"\n },\n \"values\": | ||
{\n \"auth_bsn\": \"123456789\",\n \"file\": {\n \"content\": | ||
\"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n \"file_name\": \"test_file.txt\"\n | ||
\ },\n \"firstName\": \"We Are\"\n }\n },\n \"message\": \"Data | ||
received\"\n}\n" | ||
headers: | ||
Connection: | ||
- close | ||
Content-Length: | ||
- '850' | ||
Content-Type: | ||
- application/json | ||
Date: | ||
- Thu, 16 Jan 2025 13:23:18 GMT | ||
Server: | ||
- Werkzeug/3.1.3 Python/3.12.8 | ||
status: | ||
code: 201 | ||
message: CREATED | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/openforms/registrations/contrib/json_dump/tests/test_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.core.exceptions import ValidationError | ||
from django.test import TestCase | ||
|
||
from ..config import validate_path | ||
|
||
|
||
class JSONDumpConfigTests(TestCase): | ||
def test_validate_path(self): | ||
with self.assertRaises(ValidationError): | ||
validate_path("..") |