-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ [#4908] Update backend test for json registration plugin
* Use VCR instead of mock now * Added check on the response * Added check on attachment encoding
- Loading branch information
1 parent
465ec1b
commit 61b638d
Showing
3 changed files
with
185 additions
and
85 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
...s/JSONBackendTests.test_exception_raised_when_service_returns_unexpected_status_code.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,54 @@ | ||
interactions: | ||
- request: | ||
body: '{"values": {"firstName": "We Are", "auth_bsn": "123456789"}, "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.eyJpc3MiOiIiLCJpYXQiOjE3MzU4MDc0NTgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.bsmBEX-nSXzcGZJBkFwfhps53b-B-zTRkbg2Fz0PPs4 | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '450' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- python-requests/2.32.2 | ||
method: POST | ||
uri: http://localhost/fake_endpoint | ||
response: | ||
body: | ||
string: '<!doctype html> | ||
<html lang=en> | ||
<title>404 Not Found</title> | ||
<h1>Not Found</h1> | ||
<p>The requested URL was not found on the server. If you entered the URL manually | ||
please check your spelling and try again.</p> | ||
' | ||
headers: | ||
Connection: | ||
- close | ||
Content-Length: | ||
- '207' | ||
Content-Type: | ||
- text/html; charset=utf-8 | ||
Date: | ||
- Thu, 02 Jan 2025 08:44:18 GMT | ||
Server: | ||
- Werkzeug/3.1.3 Python/3.12.8 | ||
status: | ||
code: 404 | ||
message: NOT FOUND | ||
version: 1 |
52 changes: 52 additions & 0 deletions
52
...es/vcr_cassettes/JSONBackendTests/JSONBackendTests.test_submission_with_json_backend.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,52 @@ | ||
interactions: | ||
- request: | ||
body: '{"values": {"file": "VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu", "firstName": "We | ||
Are", "auth_bsn": "123456789"}, "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.eyJpc3MiOiIiLCJpYXQiOjE3MzU4MDY4MzAsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.4Wdq_Z4M9Fpi54coKdMb2BWSR3V5QWZboES6QLIkmfM | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '494' | ||
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\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n | ||
\ \"firstName\": \"We Are\"\n }\n },\n \"message\": \"Data received\"\n}\n" | ||
headers: | ||
Connection: | ||
- close | ||
Content-Length: | ||
- '783' | ||
Content-Type: | ||
- application/json | ||
Date: | ||
- Thu, 02 Jan 2025 08:33:50 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