Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FI-3175 Allow testers to specify new or updated client registration attempt #17

Merged
merged 7 commits into from
Dec 20, 2024
Prev Previous commit
Next Next commit
Update registration success test to check input for expected response…
… code
alisawallace committed Dec 13, 2024
commit 0e0e6053cb5e723bf3182656dc01ea2b5f866d8a
7 changes: 6 additions & 1 deletion lib/udap_security_test_kit/registration_success_test.rb
Original file line number Diff line number Diff line change
@@ -61,7 +61,12 @@ class RegistrationSuccessTest < Inferno::Test

post(udap_registration_endpoint, body: reg_body, headers: reg_headers)

assert_response_status(201)
if udap_client_registration_status == 'new'
assert_response_status(201)
elsif udap_client_registration_status == 'update'
assert_response_status(200)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is considerably more strict than the spec, which just says:

If the Authorization Server returns the same client_id in the registration response for a modification request, it SHOULD also return a 200 OK HTTP response code.

Copy link
Collaborator Author

@alisawallace alisawallace Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt more comfortable with this strict behavior because this is really more of a convenience option for testers that they can opt in to use, rather than a behavior the tests are requiring them to demonstrate. The only thing they are technically required to demonstrate is that a new registration returns a 201 response, it's just that in practice this can be difficult to do (especially in repeated test runs) since we're always working with a limited set of client identities that are likely to already be in the system.

However, we could expand the acceptable range of valid response status codes for the "update" case to make it a little more flexible (accept either 201 or 200? Anything in the 200 range?) What I don't want to do is open it up too much to where the test can technically pass when the modification attempt didn't actually succeed. The next test (registration success contents) would likely catch that but still.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 201 or 200 for an update would be fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I updated the code, unit tests, and descriptions to reflect this.

end

assert_valid_json(response[:body])
output udap_registration_response: response[:body]
end