Sha256: 29490adde99d1ccce8e65a818c8053679537ebb1a09264d98f0c2570ce5059b1
Contents?: true
Size: 1.09 KB
Versions: 5
Compression:
Stored size: 1.09 KB
Contents
require 'test_helper' class HostObserverTest < ActiveSupport::TestCase test "tokens should be removed based on build state" do disable_orchestration h = hosts(:one) as_admin do Setting[:token_duration] = 60 assert_difference('Token.count') do h.build = true h.save! end assert_difference('Token.count', -1) do h.build = false h.save! end end end test "pxe template should have a token when created" do disable_orchestration host = as_admin do Setting[:token_duration] = 30 host = Host.create! :name => "foo", :mac => "aabbeeddccff", :ip => "2.3.4.244", :managed => true, :build => true, :architecture => architectures(:x86_64), :environment => Environment.first, :puppet_proxy_id => 1, :domain => Domain.first, :operatingsystem => operatingsystems(:centos5_3), :subnet => subnets(:one), :url_options => {:host => 'foreman', :protocol => "http://"} end assert host.token.try(:value).present? assert host.send(:generate_pxe_template)["token=#{host.token.value}"] end end
Version data entries
5 entries across 5 versions & 1 rubygems