Sha256: 9173e70c30bfc3f5daa303d4be6a43e5dc726a5daad6bf54f1c86361d7c0a94a

Contents?: true

Size: 988 Bytes

Versions: 4

Compression:

Stored size: 988 Bytes

Contents

require 'test_plugin_helper'

module ForemanSalt
  class Api::V2::SaltStatesControllerTest < ActionController::TestCase
    test 'should get index' do
      get :index, {}
      assert_response :success
      assert_template 'api/v2/salt_states/index'
    end

    test 'should show state' do
      state = ForemanSalt::SaltModule.create(:name => 'foo.bar.baz')
      get :show, :id => state.id
      assert_response :success
      assert_template 'api/v2/salt_states/show'
    end

    test 'should create state' do
      post :create, :state => { :name => 'unicorn' }
      assert_response :success
      assert ForemanSalt::SaltModule.find_by_name('unicorn')
      assert_template 'api/v2/salt_states/create'
    end

    test 'should delete state' do
      state = ForemanSalt::SaltModule.create(:name => 'foo.bar.baz')
      assert_difference('ForemanSalt::SaltModule.count', -1) do
        delete :destroy, :id => state.id
      end
      assert_response :success
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_salt-2.1.0 test/functional/api/v2/salt_states_controller_test.rb
foreman_salt-2.0.2 test/functional/api/v2/salt_states_controller_test.rb
foreman_salt-2.0.1 test/functional/api/v2/salt_states_controller_test.rb
foreman_salt-2.0.0 test/functional/api/v2/salt_states_controller_test.rb