Sha256: 372feeb15b27b6809eb1fb922a1af606ab8abbf3a0a643ae0dd93f9ed7d36cf9

Contents?: true

Size: 1.08 KB

Versions: 44

Compression:

Stored size: 1.08 KB

Contents

require 'test_puppet_helper'
module ForemanPuppet
  module Api
    module V2
      class ConfigGroupsControllerTest < ActionController::TestCase
        setup do
          @routes = ForemanPuppet::Engine.routes
        end

        let(:puppetclasses) { FactoryBot.create_list(:puppetclass, 2) }
        let(:config_group) { FactoryBot.create(:config_group) }

        test 'should create config group' do
          assert_difference('ConfigGroup.count') do
            post :create, params: { config_group: { name: 'config-group', puppetclass_ids: puppetclasses.map(&:id) } }
          end
          assert_response :created
        end

        test 'should update config group' do
          name = 'new name'
          put :update, params: { id: config_group.to_param,
                                 config_group: { name: name,
                                                 puppetclass_ids: puppetclasses.map(&:id) } }
          assert_response :success
          response = JSON.parse(@response.body)
          assert_equal 2, response['puppetclasses'].count
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
foreman_puppet-8.0.0 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-6.4.0 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-7.0.0 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-6.3.0 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-6.2.0 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-6.1.1 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-5.1.3 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-6.1.0 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-6.0.1 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-6.0.0 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-5.1.2 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-4.1.1 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-5.1.1 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-5.1.0 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-4.1.0 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-4.0.4 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-5.0.0 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-4.0.3 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-4.0.2 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb
foreman_puppet-3.0.7 test/controllers/foreman_puppet/api/v2/config_groups_controller_test.rb