Sha256: 038d4b2cba49f9199b841331813177cdd0b54f4a11fc964d4692351acaa1b181

Contents?: true

Size: 1.34 KB

Versions: 23

Compression:

Stored size: 1.34 KB

Contents

require_relative '../../../test_plugin_helper'

module Api
  module V2
    class FactValuesControllerExtensionsTest < ActionController::TestCase
      include FactImporterIsolation
      allow_transactions_for_any_importer

      tests Api::V2::FactValuesController

      setup do
        User.current = users(:admin)
        @facts       = {
            "interfaces"        => "lo,eth0",
            "ipaddress"         => "192.168.100.42",
            "ipaddress_eth0"    => "192.168.100.42",
            "macaddress_eth0"   => "AA:BB:CC:DD:EE:FF",
            "discovery_bootif"  => "AA:BB:CC:DD:EE:FF",
            "memorysize_mb"     => "42000.42",
            "discovery_version" => "3.0.0",
        }
        FactoryBot.create(:setting,
                           :name     => 'discovery_hostname',
                           :value    => 'discovery_bootif',
                           :category => 'Setting::Discovered')
      end


      test 'list discovered host facts' do
        disable_orchestration
        facts = @facts.merge({ "somefact" => "abc" })
        host = discover_host_from_facts(facts)
        get :index, params: { :host_id => host.id }
        assert_response :success
        show_response = ActiveSupport::JSON.decode(@response.body)
        assert_equal "abc", show_response['results'].values.first['somefact']
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
foreman_discovery-17.0.5 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-17.0.4 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-17.0.3 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-17.0.2 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-17.0.1 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-16.3.6 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-17.0.0 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-16.3.5 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-16.1.4 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-16.1.3 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-16.3.4 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-16.3.1 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-16.1.2 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-16.2.0 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-16.1.0 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-16.0.1 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-16.0.0 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-15.1.0 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-15.0.2 test/functional/api/v2/fact_value_extensions_test.rb
foreman_discovery-15.0.1 test/functional/api/v2/fact_value_extensions_test.rb