Sha256: c70f8c7a5186ddd736172a05c3883fc77d6b24686c99aedf2a8cb72fedea44b6

Contents?: true

Size: 700 Bytes

Versions: 5

Compression:

Stored size: 700 Bytes

Contents

require 'test_plugin_helper'

class DiscoveryTaxonomyExtensionsTest < ActiveSupport::TestCase
  setup do
    @facts = parse_json_fixture('/facts.json')['facts']
    set_default_settings
  end

  test 'deleting location does not hard fail if there is associated discovered host' do
    location = FactoryBot.create(:location)

    assert (host = discover_host_from_facts(@facts))
    host.location = location
    assert host.save

    assert_nothing_raised do
      refute location.destroy, 'Location was destroyed but it should not be allowed'
    end
  end

  def parse_json_fixture(relative_path)
    return JSON.parse(File.read(File.expand_path(File.dirname(__FILE__) + relative_path)))
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-13.0.1 test/unit/discovery_taxonomy_extensions_test.rb
foreman_discovery-12.0.2 test/unit/discovery_taxonomy_extensions_test.rb
foreman_discovery-12.0.1 test/unit/discovery_taxonomy_extensions_test.rb
foreman_discovery-12.0.0 test/unit/discovery_taxonomy_extensions_test.rb
foreman_discovery-11.0.0 test/unit/discovery_taxonomy_extensions_test.rb