Sha256: 91391ab34be1ae8b9f616f1eecfd6c57e53ec6101985ba8982755958fc0e4308

Contents?: true

Size: 808 Bytes

Versions: 3

Compression:

Stored size: 808 Bytes

Contents

require 'test_plugin_helper'

class UrlRemediationsRetrieverTest < ActiveSupport::TestCase
  test 'Calls the given url' do
    Setting[:rh_cloud_token] = 'TEST_TOKEN'
    retreiver = ForemanRhCloud::UrlRemediationsRetriever.new(
      url: 'http://test.example.com',
      payload: 'TEST_PAYLOAD',
      headers: {
        custom1: 'TEST_HEADER',
      }
    )

    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

3 entries across 3 versions & 1 rubygems

Version Path
foreman_rh_cloud-5.0.35 test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb
foreman_rh_cloud-5.0.34 test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb
foreman_rh_cloud-5.0.33 test/unit/services/foreman_rh_cloud/url_remediations_retriever_test.rb