Repository navigation
ID-240: add client and server update and delete tests - #47
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| Subscription Workflow" group first. | ||
| ) | ||
|
|
||
| JSON.parse(creation_requests.first.response_body)['id'] |
There was a problem hiding this comment.
.first returns the oldest successful Subscription creation in the session. The group description says to re-run "Demonstrate the Subscription Workflow" before re-running this group. But after that re-run, .first still points at the Subscription this group already deleted. So the PUT test's read gets a 404/410 and fails.
The subscription_creation tag is also shared with the event-notification groups, so this isn't necessarily the workflow group's Subscription anyway. Could this use .last, with the descriptions changed to say "the most recently created Subscription"? A spec for the re-run case would be good too.
| JSON.parse(creation_requests.first.response_body)['id'] | |
| JSON.parse(creation_requests.last.response_body)['id'] |
There was a problem hiding this comment.
addressed - add a specific "workflow" tag so that there's only ever one subscription tagged in this way and added a spec test to help ensure future updates don't change that.
| current_status = current_subscription_status_code(current_subscription) | ||
| current_hash = current_subscription.source_hash.deep_dup.merge('status' => current_status) | ||
| Hana::Patch.new(patch).apply(current_hash) | ||
| rescue Hana::Patch::Exception, Hana::Pointer::Exception => e |
There was a problem hiding this comment.
parse_json_patch only checks that each operation has a string op. Hana reads value and from with Hash#fetch, so a patch like [{"op":"add","path":"/reason"}] raises KeyError. That isn't rescued here, so the client gets a 500 instead of a 4xx. Could we add KeyError to the rescue and add a spec for a missing value?
| rescue Hana::Patch::Exception, Hana::Pointer::Exception => e | |
| rescue Hana::Patch::Exception, Hana::Pointer::Exception, KeyError => e |
There was a problem hiding this comment.
There were other potential issues that didn't raise a KeyError, so implemented this with some manual checks before sending to Hana in added a broad rescue around it.
Reproduced that server suite error and it is mirrored on the client suite with the additional "no custom extensions" error, so it is fine. |

Summary
This PR adds tests for FHIR Subscription update (PUT and PATCH (json)) and delete transactions to both the Subscriptions client and server tests.
Additionally it
Testing Guidance