Sha256: cd97984e9c543312d7d3c8f7e9f857b8bbc675b34cbded93fed14d24dc12987f

Contents?: true

Size: 1017 Bytes

Versions: 1

Compression:

Stored size: 1017 Bytes

Contents

require 'test_plugin_helper'

class HostsControllerTest < ActionController::TestCase
  setup do
    User.current = User.find_by_login "admin"
  end


    test "index returns YAML output for rundeck" do
      get :index, {:format => 'yaml'}, set_session_user
      hosts = YAML.load(@response.body)
      assert_not_empty hosts
      host = Host.first
      unless (host.nil? || host.name.nil? || hosts.nil? || hosts[host.name].nil?)
        assert_equal host.os.name, hosts[host.name]["osName"] # rundeck-specific field
      end
    end

    test "show returns YAML output for rundeck" do
      host = Host.first
      get :show, {:id => host, :format => 'yaml'}, set_session_user
      yaml = YAML.load(@response.body)
      unless (host.nil? || host.name.nil? || host.os.nil? || yaml[host.name].nil?)
        assert_kind_of Hash, yaml[host.name]
        assert_equal host.name, yaml[host.name]["hostname"]
        assert_equal host.os.name, yaml[host.name]["osName"]  # rundeck-specific field
      end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_host_rundeck-0.0.2 test/functional/hosts_controller_test.rb