Skip to content

Commit

Permalink
✅ [#4993] Tests for fetching options from Referentielijsten
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed Jan 13, 2025
1 parent 1bf7ad6 commit 782e1e5
Show file tree
Hide file tree
Showing 10 changed files with 516 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/openforms/formio/dynamic_config/dynamic_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def add_options_to_config(
data_src = glom(component, "openForms.dataSrc", default=None)
# TODO make these constants/choices?
# TODO move the logic to a separate app?
# TODO should the entire form crash on error?
if data_src == "referentielijsten":
items_expression = {
"map": [{"var": "results"}, [{"var": "code"}, {"var": "naam"}]]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.2
method: GET
uri: http://localhost:8004/api/v1/items?tabel__code=non-existent
response:
body:
string: '{"count":0,"next":null,"previous":null,"results":[]}'
headers:
Allow:
- GET, HEAD, OPTIONS
Content-Length:
- '52'
Content-Security-Policy:
- 'default-src ''self''; worker-src ''self'' blob:; font-src ''self'' fonts.gstatic.com;
object-src ''none''; img-src ''self'' data: cdn.redoc.ly; style-src ''self''
''unsafe-inline'' fonts.googleapis.com; frame-src ''self''; base-uri ''self'';
form-action ''self''; frame-ancestors ''none''; script-src ''self'' ''unsafe-inline'''
Content-Type:
- application/json
Cross-Origin-Opener-Policy:
- same-origin
Referrer-Policy:
- same-origin
Vary:
- origin
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.2
method: GET
uri: http://localhost:8004/api/v1/items?tabel__code=tabel1
response:
body:
string: '{"count":2,"next":null,"previous":null,"results":[{"code":"option1","naam":"Option
1","begindatumGeldigheid":"2025-01-07T14:17:53Z","einddatumGeldigheid":null,"aanvullendeGegevens":null},{"code":"option2","naam":"Option
2","begindatumGeldigheid":"2025-01-07T14:17:59Z","einddatumGeldigheid":null,"aanvullendeGegevens":null}]}'
headers:
Allow:
- GET, HEAD, OPTIONS
Content-Length:
- '325'
Content-Security-Policy:
- 'default-src ''self''; worker-src ''self'' blob:; font-src ''self'' fonts.gstatic.com;
object-src ''none''; img-src ''self'' data: cdn.redoc.ly; style-src ''self''
''unsafe-inline'' fonts.googleapis.com; frame-src ''self''; base-uri ''self'';
form-action ''self''; frame-ancestors ''none''; script-src ''self'' ''unsafe-inline'''
Content-Type:
- application/json
Cross-Origin-Opener-Policy:
- same-origin
Referrer-Policy:
- same-origin
Vary:
- origin
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.2
method: GET
uri: http://localhost:8004/api/v1/items?tabel__code=non-existent
response:
body:
string: '{"count":0,"next":null,"previous":null,"results":[]}'
headers:
Allow:
- GET, HEAD, OPTIONS
Content-Length:
- '52'
Content-Security-Policy:
- 'default-src ''self''; worker-src ''self'' blob:; font-src ''self'' fonts.gstatic.com;
object-src ''none''; img-src ''self'' data: cdn.redoc.ly; style-src ''self''
''unsafe-inline'' fonts.googleapis.com; frame-src ''self''; base-uri ''self'';
form-action ''self''; frame-ancestors ''none''; script-src ''self'' ''unsafe-inline'''
Content-Type:
- application/json
Cross-Origin-Opener-Policy:
- same-origin
Referrer-Policy:
- same-origin
Vary:
- origin
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Connection:
- keep-alive
User-Agent:
- python-requests/2.32.2
method: GET
uri: http://localhost:8004/api/v1/items?tabel__code=tabel1
response:
body:
string: '{"count":2,"next":null,"previous":null,"results":[{"code":"option1","naam":"Option
1","begindatumGeldigheid":"2025-01-07T14:17:53Z","einddatumGeldigheid":null,"aanvullendeGegevens":null},{"code":"option2","naam":"Option
2","begindatumGeldigheid":"2025-01-07T14:17:59Z","einddatumGeldigheid":null,"aanvullendeGegevens":null}]}'
headers:
Allow:
- GET, HEAD, OPTIONS
Content-Length:
- '325'
Content-Security-Policy:
- 'default-src ''self''; worker-src ''self'' blob:; font-src ''self'' fonts.gstatic.com;
object-src ''none''; img-src ''self'' data: cdn.redoc.ly; style-src ''self''
''unsafe-inline'' fonts.googleapis.com; frame-src ''self''; base-uri ''self'';
form-action ''self''; frame-ancestors ''none''; script-src ''self'' ''unsafe-inline'''
Content-Type:
- application/json
Cross-Origin-Opener-Policy:
- same-origin
Referrer-Policy:
- same-origin
Vary:
- origin
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit 782e1e5

Please sign in to comment.