Sha256: f212cf49ca34790a46fbc74794844e3371a721c3643b95a995d0c7cde69bc599

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

require 'test_plugin_helper'

module ForemanSalt
  module Api
    module V2
      class SaltAutosignControllerTest < ActionController::TestCase
        setup do
          @proxy = FactoryBot.create(:smart_proxy, :with_salt_feature)
          @host = FactoryBot.create(:host, :managed)
          @host.salt_proxy = @proxy
          ProxyAPI::Salt.any_instance.stubs(:autosign_list).returns(%w[foo bar baz])
        end

        test 'should get index' do
          get :index, params: { smart_proxy_id: @proxy.id }
          assert_response :success
        end

        test 'should create autosign' do
          ProxyAPI::Salt.any_instance.expects(:autosign_create).once.returns(true)
          post :create, params: { smart_proxy_id: @proxy.id, record: 'unicorn.example.com' }
          assert_response :success
        end

        test 'should delete autosign' do
          ProxyAPI::Salt.any_instance.expects(:autosign_remove).once.returns(true)
          delete :destroy, params: { smart_proxy_id: @proxy.id, record: 'unicorn.example.com' }
          assert_response :success
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
foreman_salt-16.0.0 test/functional/api/v2/salt_autosign_controller_test.rb
foreman_salt-15.2.3 test/functional/api/v2/salt_autosign_controller_test.rb
foreman_salt-15.2.2 test/functional/api/v2/salt_autosign_controller_test.rb
foreman_salt-15.2.1 test/functional/api/v2/salt_autosign_controller_test.rb
foreman_salt-15.2.0 test/functional/api/v2/salt_autosign_controller_test.rb
foreman_salt-15.1.0 test/functional/api/v2/salt_autosign_controller_test.rb
foreman_salt-15.0.0 test/functional/api/v2/salt_autosign_controller_test.rb
foreman_salt-14.1.0 test/functional/api/v2/salt_autosign_controller_test.rb