Sha256: ab674baf99caf481600ffc0260ff5b51b3cfdbfd1f1b67e3287379486379fe58

Contents?: true

Size: 882 Bytes

Versions: 6

Compression:

Stored size: 882 Bytes

Contents

require 'test_plugin_helper'

class URLRemediationsRetrieverTest < ActiveSupport::TestCase
  test 'Calls the given url' do
    retreiver = ForemanRhCloud::URLRemediationsRetriever.new(
      organization_id: FactoryBot.create(:organization).id,
      url: 'http://test.example.com',
      payload: 'TEST_PAYLOAD',
      headers: {
        custom1: 'TEST_HEADER',
      }
    )

    retreiver.stubs(:cert_auth_available?).returns(true)

    response = mock('response')
    response.stubs(:body).returns('TEST_RESPONSE')
    retreiver.expects(:execute_cloud_request).with do |params|
      params[:method] == :get &&
      params[:url] == 'http://test.example.com' &&
      params[:headers][:custom1] == 'TEST_HEADER' &&
      params[:payload] == "\"TEST_PAYLOAD\""
    end.returns(response)

    actual = retreiver.create_playbook

    assert_equal 'TEST_RESPONSE', actual
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_rh_cloud-11.2.0 test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb
foreman_rh_cloud-11.1.0 test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb
foreman_rh_cloud-11.0.3 test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb
foreman_rh_cloud-11.0.2 test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb
foreman_rh_cloud-11.0.1 test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb
foreman_rh_cloud-11.0.0 test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb