Sha256: f57df143a46d22be4b93dbe061db50500c0b72fdeb4dcb0636883a06e97a3fcc

Contents?: true

Size: 801 Bytes

Versions: 7

Compression:

Stored size: 801 Bytes

Contents

require 'test_helper'

class HostDiscoveredTest < ActiveSupport::TestCase
  setup do
    User.current = User.find_by_login "admin"
  end

  test "should be able to create Host::Discovered objects" do
    host = Host.create :name => "mydiscoveredhost", :type => "Host::Discovered"
    assert host.is_a?(Host::Discovered)
  end

  test "should import facts from yaml as Host::Discovered" do
    assert Host::Discovered.importHostAndFacts(File.read(File.expand_path(File.dirname(__FILE__) + "/facts.yml")))
  end

  test "should be able to refresh facts" do
    host = Host.create :name => "mydiscoveredhost", :ip => "1.2.3.4", :type => "Host::Discovered"
    ForemanDiscovery::Facts.any_instance.stubs(:facts).returns({"macaddress_eth0" => "aa:bb:cc:dd:ee:ff"})
    assert host.refresh_facts
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
foreman_discovery-1.1.1 test/unit/host_discovered_test.rb
foreman_discovery-1.0.2 test/unit/host_discovered_test.rb
foreman_discovery-1.0.0 test/unit/host_discovered_test.rb
foreman_discovery-1.0.0.rc4 test/unit/host_discovered_test.rb
foreman_discovery-1.0.0.rc3 test/unit/host_discovered_test.rb
foreman_discovery-1.0.0.rc2 test/unit/host_discovered_test.rb
foreman_discovery-1.0.0.rc1 test/unit/host_discovered_test.rb