Revision 3f8e6c33
Added by Imri Zvik almost 9 years ago
test/unit/host_test.rb | ||
---|---|---|
assert_equal ["Common", "Common/db"].sort, hosts.map { |h| h.hostgroup.title }.sort
|
||
end
|
||
|
||
test "can search hosts by numeric and string facts" do
|
||
host = FactoryGirl.create(:host, :hostname => 'num001.example.com')
|
||
host.import_facts({:architecture => "x86_64", :interfaces => 'eth0', :operatingsystem => 'RedHat-test', :operatingsystemrelease => '6.2',:memory_mb => "64498",:custom_fact => "find_me"})
|
||
|
||
hosts = Host::Managed.search_for("facts.memory_mb > 112889")
|
||
assert_equal hosts.count, 0
|
||
|
||
hosts = Host::Managed.search_for("facts.memory_mb > 6544")
|
||
assert_equal hosts.count, 1
|
||
assert_equal ["num001.example.com"], hosts.map { |h| h.name }.sort
|
||
|
||
hosts = Host::Managed.search_for("facts.custom_fact = find_me")
|
||
assert_equal hosts.count, 1
|
||
assert_equal ["num001.example.com"], hosts.map { |h| h.name }.sort
|
||
end
|
||
|
||
test "non-admin user with edit_hosts permission can update interface" do
|
||
@one = users(:one)
|
||
# add permission for user :one
|
Also available in: Unified diff
Fixes #11150 - Allow searching of facts as types other than string