Skip to content

Commit

Permalink
[#3688] Update payment test
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Mar 22, 2024
1 parent 87040b8 commit bd65fb7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ interactions:
body: '{"type": "http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48",
"record": {"typeVersion": 3, "data": {"age": 20, "name": {"last.name": "My last
name"}, "submission_pdf_url": "http://example.com", "submission_csv_url": "http://example.com",
"submission_payment_completed": false, "submission_payment_amount": "0", "submission_payment_public_ids":
[], "submission_date": "2020-02-02T00:00:00+00:00"}, "startAt": "2020-02-02"}}'
"submission_payment_completed": false, "nested": {"unrelated": "some_value",
"submission_payment_amount": 0}, "submission_payment_public_ids": [], "submission_date":
"2020-02-02T00:00:00+00:00"}, "startAt": "2020-02-02"}}'
headers:
Accept:
- '*/*'
Expand All @@ -17,7 +18,7 @@ interactions:
Content-Crs:
- EPSG:4326
Content-Length:
- '456'
- '493'
Content-Type:
- application/json
User-Agent:
Expand All @@ -26,21 +27,21 @@ interactions:
uri: http://localhost:8002/api/v2/objects
response:
body:
string: '{"url":"http://localhost:8002/api/v2/objects/2c287cd4-7737-473d-84de-8b0a018a46bb","uuid":"2c287cd4-7737-473d-84de-8b0a018a46bb","type":"http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","record":{"index":1,"typeVersion":3,"data":{"age":20,"name":{"last.name":"My
last name"},"submission_pdf_url":"http://example.com","submission_csv_url":"http://example.com","submission_payment_completed":false,"submission_payment_amount":"0","submission_payment_public_ids":[],"submission_date":"2020-02-02T00:00:00+00:00"},"geometry":null,"startAt":"2020-02-02","endAt":null,"registrationAt":"2024-03-19","correctionFor":null,"correctedBy":null}}'
string: '{"url":"http://localhost:8002/api/v2/objects/302d84d5-b428-4e6b-8fb5-9127a893fd5e","uuid":"302d84d5-b428-4e6b-8fb5-9127a893fd5e","type":"http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","record":{"index":1,"typeVersion":3,"data":{"age":20,"name":{"last.name":"My
last name"},"submission_pdf_url":"http://example.com","submission_csv_url":"http://example.com","submission_payment_completed":false,"nested":{"unrelated":"some_value","submission_payment_amount":0},"submission_payment_public_ids":[],"submission_date":"2020-02-02T00:00:00+00:00"},"geometry":null,"startAt":"2020-02-02","endAt":null,"registrationAt":"2024-03-22","correctionFor":null,"correctedBy":null}}'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Content-Crs:
- EPSG:4326
Content-Length:
- '669'
- '703'
Content-Type:
- application/json
Cross-Origin-Opener-Policy:
- same-origin
Location:
- http://localhost:8002/api/v2/objects/2c287cd4-7737-473d-84de-8b0a018a46bb
- http://localhost:8002/api/v2/objects/302d84d5-b428-4e6b-8fb5-9127a893fd5e
Referrer-Policy:
- same-origin
X-Content-Type-Options:
Expand All @@ -52,11 +53,9 @@ interactions:
message: Created
- request:
body: '{"type": "http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48",
"record": {"typeVersion": 3, "data": {"age": 20, "name": {"last.name": "My last
name"}, "submission_date": "2020-02-02T00:00:00+00:00", "submission_pdf_url":
"", "submission_csv_url": "", "submission_payment_completed": true, "submission_payment_amount":
"10.01", "submission_payment_public_ids": ["TEST-123"]}, "startAt": "2020-02-02",
"geometry": {"type": "Point", "coordinates": [52.36673378967122, 4.893164274470299]}}}'
"record": {"typeVersion": 3, "data": {"submission_payment_completed": true,
"nested": {"submission_payment_amount": 10.01}, "submission_payment_public_ids":
["TEST-123"]}, "startAt": "2020-02-02"}}'
headers:
Accept:
- '*/*'
Expand All @@ -69,24 +68,24 @@ interactions:
Content-Crs:
- EPSG:4326
Content-Length:
- '519'
- '293'
Content-Type:
- application/json
User-Agent:
- python-requests/2.31.0
method: PUT
uri: http://localhost:8002/api/v2/objects/2c287cd4-7737-473d-84de-8b0a018a46bb
method: PATCH
uri: http://localhost:8002/api/v2/objects/302d84d5-b428-4e6b-8fb5-9127a893fd5e
response:
body:
string: '{"url":"http://localhost:8002/api/v2/objects/2c287cd4-7737-473d-84de-8b0a018a46bb","uuid":"2c287cd4-7737-473d-84de-8b0a018a46bb","type":"http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","record":{"index":2,"typeVersion":3,"data":{"age":20,"name":{"last.name":"My
last name"},"submission_date":"2020-02-02T00:00:00+00:00","submission_pdf_url":"","submission_csv_url":"","submission_payment_completed":true,"submission_payment_amount":"10.01","submission_payment_public_ids":["TEST-123"]},"geometry":{"type":"Point","coordinates":[52.36673378967122,4.893164274470299]},"startAt":"2020-02-02","endAt":null,"registrationAt":"2024-03-19","correctionFor":null,"correctedBy":null}}'
string: '{"url":"http://localhost:8002/api/v2/objects/302d84d5-b428-4e6b-8fb5-9127a893fd5e","uuid":"302d84d5-b428-4e6b-8fb5-9127a893fd5e","type":"http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","record":{"index":2,"typeVersion":3,"data":{"age":20,"name":{"last.name":"My
last name"},"nested":{"unrelated":"some_value","submission_payment_amount":10.01},"submission_date":"2020-02-02T00:00:00+00:00","submission_csv_url":"http://example.com","submission_pdf_url":"http://example.com","submission_payment_completed":true,"submission_payment_public_ids":["TEST-123"]},"geometry":null,"startAt":"2020-02-02","endAt":null,"registrationAt":"2024-03-22","correctionFor":null,"correctedBy":null}}'
headers:
Allow:
- GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Crs:
- EPSG:4326
Content-Length:
- '710'
- '716'
Content-Type:
- application/json
Cross-Origin-Opener-Policy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def test_update_payment_status(self):
"submission_pdf_url": "http://example.com",
"submission_csv_url": "http://example.com",
"submission_payment_completed": False,
"submission_payment_amount": "0",
"nested": {
"unrelated": "some_value",
"submission_payment_amount": 0,
},
"submission_payment_public_ids": [],
"submission_date": timezone.now().isoformat(),
},
Expand Down Expand Up @@ -137,7 +140,7 @@ def test_update_payment_status(self):
},
{
"variable_key": "payment_amount",
"target_path": ["submission_payment_amount"],
"target_path": ["nested", "submission_payment_amount"],
},
{
"variable_key": "payment_public_order_ids",
Expand All @@ -164,5 +167,11 @@ def test_update_payment_status(self):
result_data = result["record"]["data"]

self.assertTrue(result_data["submission_payment_completed"])
self.assertEqual(result_data["submission_payment_amount"], "10.01")
self.assertEqual(
result_data["nested"],
{
"unrelated": "some_value",
"submission_payment_amount": 10.01,
},
)
self.assertEqual(result_data["submission_payment_public_ids"], ["TEST-123"])

0 comments on commit bd65fb7

Please sign in to comment.