Sha256: b3ecadfc800ddb1383013b40990254d1098604c9cea59ee4b9ab1ad307bf0fb9

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

module Api
  module V2
    # Tests for the controller to CRUD Ansible Variables
    class AnsibleVariablesControllerTest < ActionController::TestCase
      setup do
        @variable = FactoryBot.create(:ansible_variable)
      end

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

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

      test 'should import' do
        put :import,
            :session => set_session_user
        assert_response :success
      end

      test 'should obsolete' do
        put :obsolete,
            :session => set_session_user
        assert_response :success
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_ansible-2.3.2 test/functional/api/v2/ansible_variables_controller_test.rb
foreman_ansible-2.3.1 test/functional/api/v2/ansible_variables_controller_test.rb
foreman_ansible-2.3.0 test/functional/api/v2/ansible_variables_controller_test.rb