Sha256: 7164e5cccb1864d6886e4b65f4b80e1a4aa0267899e561114753ec404e27abcc

Contents?: true

Size: 1023 Bytes

Versions: 8

Compression:

Stored size: 1023 Bytes

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

8 entries across 8 versions & 1 rubygems

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