-
Notifications
You must be signed in to change notification settings - Fork 898
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
Enhanced API to have a task created for provider refreshes #14387
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -744,6 +744,36 @@ def failed_auth_action(id) | |
expect(response).to have_http_status(:ok) | ||
expect_results_to_match_hash("results", [failed_auth_action(p1.id), failed_auth_action(p2.id)]) | ||
end | ||
|
||
it "provider refresh are created with a task" do | ||
api_basic_authorize collection_action_identifier(:providers, :refresh) | ||
|
||
provider = FactoryGirl.create(:ext_management_system, sample_vmware.symbolize_keys.except(:type)) | ||
provider.update_authentication(:default => default_credentials.symbolize_keys) | ||
allow_any_instance_of(provider.class).to receive_messages(:authentication_status_ok? => true) | ||
|
||
run_post(providers_url(provider.id), gen_request(:refresh)) | ||
|
||
expect_single_action_result(:success => true, | ||
:message => a_string_matching("Provider .* refreshing"), | ||
:href => providers_url(provider.id), | ||
:task => true) | ||
end | ||
|
||
it "provider refresh for provider_class=provider are created with a task" do | ||
api_basic_authorize collection_action_identifier(:providers, :refresh) | ||
|
||
provider = FactoryGirl.create(:provider_foreman, :zone => @zone, :url => "example.com", :verify_ssl => false) | ||
provider.update_authentication(:default => default_credentials.symbolize_keys) | ||
allow_any_instance_of(provider.class).to receive_messages(:authentication_status_ok? => true) | ||
|
||
run_post(providers_url(provider.id) + '?provider_class=provider', gen_request(:refresh)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I take it whatever caused us to have to write queries like this is still an issue? 😁 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, we'll need to enhance the run_post method to support options like we do with run_get. |
||
|
||
expect_single_action_result(:success => true, | ||
:message => a_string_matching("Provider .* refreshing"), | ||
:href => providers_url(provider.id), | ||
:task => true) | ||
end | ||
end | ||
|
||
describe 'Providers import VM' do | ||
|
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.
Although still problematic, WDYT about doing something like:
to avoid the use of
any_instance_of
?