-
Notifications
You must be signed in to change notification settings - Fork 899
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
Updating validation when creating or editing a provider's endpoint. #10999
Updating validation when creating or editing a provider's endpoint. #10999
Conversation
@miq-bot add_label providers/containers, api @simon3z @dkorn @abellotti please review |
b6fcb24
to
5f2b908
Compare
@@ -107,6 +107,11 @@ def destroy_provider(provider) | |||
end | |||
|
|||
def update_provider_authentication(provider, data) | |||
connection_configurations = data[CONNECTION_ATTR] | |||
unless connection_configurations.blank? | |||
provider.authentication_check_types_queue(provider.default_authentication, :save => true) |
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.
Style: @yaacov it is possible to have just a one-liner here. Anyway I am not against what you have here ATM.
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.
provider.authentication_check_types_queue(provider.default_authentication, :save => true) unless data[CONNECTION_ATTR].blank?
@simon3z
this line is ok, but rubocop say it's too long :-( any idea ?
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.
@simon3z 👍
chenged it to:
endpoints = data[CONNECTION_ATTR]
provider.authentication_check_types_queue(provider.default_authentication, :save => true) unless endpoints.blank?
LGTM 👍 |
5f2b908
to
3a1a556
Compare
@abellotti @imtayadeway please review |
Can we add a test for this ? |
083b511
to
1a54565
Compare
@simon3z @abellotti 👍 👍 about the missing tests While writing the tests I found the real problem. @kbrock please review |
👍 cc @chessbyte ready for merge |
I'm 👍 with this. |
The fix looks good.....I'm just wondering if a) The problem was in the model, and b) The tests aren't concerned with the response from the API, that a model spec would be more appropriate? |
To follow up on @imtayadeway there are [examples] in the tests for testing that method. Also, if you are testing a particular method, please use a e.g.: describe VmOrTemplate do
describe "#connection_configuration_by_role" do
# context if you need
it "works with no parameters" do
# ...
end
end
end |
d6a1a03
to
74a00da
Compare
A regression was created when introducing multiple provider endpoints. The function for updating authentications was not updated to update when changing the endpoints and authentications. This commit updates the authentication is this cases. Issue: ManageIQ#7256
74a00da
to
7840799
Compare
[1] To make this bug happen you need to call the function with missing authentication @kbrock I used |
Checked commit yaacov@7840799 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 |
@yaacov that's fine - I just generally prefer to test only things in the response in request specs, and leave the nitty-gritty things up to lower level tests if their behavior never bubbles up to the user in the response |
@kbrock please re-review |
👍 LGTM - Mr. @abellotti you have the floor |
Thanks @kbrock |
Description
A regression was created when introducing multiple provider endpoints to the providers API.
The function for updating authentications did not re-authenticate when changing
an endpoint or an authentication. This commit updates the authentication in this cases.
Issue
#7256