Revision 0c3e15d2
Added by Ohad Levy over 12 years ago
- ID 0c3e15d210a01b712b35ef07ccce31925ec08cd6
test/lib/net/dhcp_test.rb | ||
---|---|---|
|
||
test "dhcp record should not be created without a mac" do
|
||
assert_raise Net::Validations::Error do
|
||
Net::DhcpRecord.new :name => "test", "proxy" => smart_proxies(:one)
|
||
Net::DHCP::Record.new :hostname => "test", "proxy" => smart_proxies(:one)
|
||
end
|
||
end
|
||
|
||
test "dhcp record should not be created without a network" do
|
||
assert_raise Net::Validations::Error do
|
||
Net::DhcpRecord.new :name => "test", :mac => "aa:bb:cc:dd:ee:ff", "proxy" => smart_proxies(:one)
|
||
Net::DHCP::Record.new :hostname => "test", :mac => "aa:bb:cc:dd:ee:ff", "proxy" => smart_proxies(:one)
|
||
end
|
||
end
|
||
|
||
test "dhcp record should not be created without an ip" do
|
||
assert_raise Net::Validations::Error do
|
||
Net::DhcpRecord.new :name => "test", :mac => "aa:bb:cc:dd:ee:ff", :network => "127.0.0.0", "proxy" => smart_proxies(:one)
|
||
Net::DHCP::Record.new :hostname => "test", :mac => "aa:bb:cc:dd:ee:ff", :network => "127.0.0.0", "proxy" => smart_proxies(:one)
|
||
end
|
||
end
|
||
|
||
test "record should have dhcp attributes" do
|
||
record = Net::DhcpRecord.new(:name => "test", :mac => "aa:bb:cc:dd:ee:ff",
|
||
record = Net::DHCP::Record.new(:hostname => "test", :mac => "aa:bb:cc:dd:ee:ff",
|
||
:network => "127.0.0.0", :ip => "127.0.0.1", "proxy" => smart_proxies(:one))
|
||
assert_equal({:name => "test", :mac => "aa:bb:cc:dd:ee:ff",:network => "127.0.0.0", :ip => "127.0.0.1"}, record.send(:attrs))
|
||
assert_equal({:hostname => "test", :mac => "aa:bb:cc:dd:ee:ff",:network => "127.0.0.0", :ip => "127.0.0.1"}, record.send(:attrs))
|
||
|
||
end
|
||
|
||
test "record should be equal if their attrs are the same" do
|
||
record1 = Net::DhcpRecord.new(:name => "test", :mac => "aa:bb:cc:dd:ee:ff",
|
||
record1 = Net::DHCP::Record.new(:hostname => "test", :mac => "aa:bb:cc:dd:ee:ff",
|
||
:network => "127.0.0.0", :ip => "127.0.0.1", "proxy" => smart_proxies(:one))
|
||
record2 = Net::DhcpRecord.new(:name => "test", :mac => "aa:bb:cc:dd:ee:ff",
|
||
record2 = Net::DHCP::Record.new(:hostname => "test", :mac => "aa:bb:cc:dd:ee:ff",
|
||
:network => "127.0.0.0", :ip => "127.0.0.1", "proxy" => smart_proxies(:one))
|
||
assert_equal record1, record2
|
||
end
|
Also available in: Unified diff
fixes #1186 foreman does not forward sparc dhcp vendor options when creating a sparc Solaris host