Sha256: 5fd33b131077d0c9a6f4193bfba5a8900b37b39b72695918609e9a3d6dfe411d

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

module ForemanSalt
  module Api
    module V2
      # Tests for the controller to CRUD Salt Variables
      class SaltVariablesControllerTest < ActionController::TestCase
        setup do
          @variable = FactoryBot.create(:salt_variable)
        end

        test 'should get index' do
          get :index, :session => set_session_user
          response = JSON.parse(@response.body)
          assert_not_empty response['results']
          assert_response :success
        end

        test 'should destroy' do
          delete :destroy, :params => { :id => @variable.id }, :session => set_session_user
          assert_response :ok
          assert_not SaltVariable.exists?(@variable.id)
        end

        test 'should create' do
          params = { :key => 'test name', :salt_state_id => FactoryBot.create(:salt_module).id }
          post :create, :params => params, :session => set_session_user
          assert_response :success
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
foreman_salt-14.0.0 test/functional/api/v2/salt_variables_controller_test.rb
foreman_salt-13.2.4 test/functional/api/v2/salt_variables_controller_test.rb
foreman_salt-13.2.3 test/functional/api/v2/salt_variables_controller_test.rb
foreman_salt-13.2.2 test/functional/api/v2/salt_variables_controller_test.rb
foreman_salt-13.2.1 test/functional/api/v2/salt_variables_controller_test.rb
foreman_salt-13.2.0 test/functional/api/v2/salt_variables_controller_test.rb
foreman_salt-13.1.0 test/functional/api/v2/salt_variables_controller_test.rb