-
Notifications
You must be signed in to change notification settings - Fork 897
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
Allows specification for optional multiple identifiers #13827
Allows specification for optional multiple identifiers #13827
Conversation
- Supports current single identifier, where user must be allowed that specific role for authorization: :post: - :name: delete :identifier: vm_delete - Supports multiple identifiers, where user must be allowed at least one of the roles specified for authorization: :post: - :name: delete :identifier: - vm_delete - instance_terminate - Adding role based authorization rspecs
1debae5
to
4e9bff8
Compare
Updated Usage to leverage yaml array.
|
saved_identifier = config.identifier | ||
config.identifier = new_identifier | ||
yield | ||
config.identifier = saved_identifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in an ensure
def vms_get_test
# stuff
yield
ensure
config.identifier = saved_identifier
end
This way if a test raises an exception, you can be sure it puts the settings back.
Alternately, the test should not modify settings in this way. Instead, there should be probably be a stub_settings type method, like we do for other Settings. stubbing ensures the values return to normal after test completion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A stub method would read better as well. It's not clear (perhaps because of the vms_get_test method name), that what you are testing is different combinations of RBAC identifiers via the settings.
compare:
vms_get_test("vm_view_role1") do
#stuff
end
vs
stub_api_settings(:collections, :vms, :collection, :actions, :get, "vm_view_role1")
#stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
cc @gtanzillo |
- Introduced stub_api_action_role - Updated tests to use the new stub_api_action_role - Fixed issue in api spec helper update_user_role not able to handle identifier arrays.
Checked commits abellotti/manageiq@4e9bff8~...598ced7 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
Pivitol Story: https://www.pivotaltracker.com/story/show/139477969