Sha256: d9dbd800ed2eeb7e286769195c4c8a4c56b0bfcf4e7fd4bfcdece08ed2e51d3e

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 KB

Contents

require 'test_plugin_helper'

class ::ForemanSalt::Api::V2::SaltKeysControllerTest < ActionController::TestCase
  setup do
    @proxy = FactoryBot.create(:smart_proxy, :with_salt_feature)

    ProxyAPI::Salt.any_instance.stubs(:key_list).returns('saltstack.example.com' => { 'state' => 'unaccepted',
                                                                                      'fingerprint' => '98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c0' })
  end

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

  test 'should update keys' do
    ProxyAPI::Salt.any_instance.expects(:key_accept).once.returns(true)
    put :update, params: { :smart_proxy_id => @proxy.id, :name => 'saltstack.example.com', :state => 'accepted' }
    assert_response :success
  end

  test 'should delete keys' do
    ProxyAPI::Salt.any_instance.expects(:key_delete).once.returns(true)
    delete :destroy, params: { :smart_proxy_id => @proxy.id, :name => 'saltstack.example.com' }
    assert_response :success
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
foreman_salt-14.0.0 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-13.2.4 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-13.2.3 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-13.2.2 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-13.2.1 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-13.2.0 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-13.1.0 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-13.0.0 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-12.0.0 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-11.0.1 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-11.0.0 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-10.3.1 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-10.3.0 test/functional/api/v2/salt_keys_controller_test.rb
foreman_salt-10.2.0 test/functional/api/v2/salt_keys_controller_test.rb