aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-03-31 14:14:01 -0700
committerelijah <elijah@riseup.net>2013-03-31 14:14:01 -0700
commit9c131c1d84357175448496590e8d4e31e90118aa (patch)
tree156e4a573fd39b4f256a8c6b4eeaa78303834f02 /test/unit
parent354c455dc6d463d5eed43804d1eb3aaa95c9e471 (diff)
downloadleap_cli-9c131c1d84357175448496590e8d4e31e90118aa.tar.gz
leap_cli-9c131c1d84357175448496590e8d4e31e90118aa.tar.bz2
add ability to search for nodes using nil values.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/config_object_list_test.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/unit/config_object_list_test.rb b/test/unit/config_object_list_test.rb
index 122c6cd..d38f441 100644
--- a/test/unit/config_object_list_test.rb
+++ b/test/unit/config_object_list_test.rb
@@ -10,12 +10,28 @@ class ConfigObjectListTest < MiniTest::Unit::TestCase
def test_complex_node_search
domain = provider.domain
- nodes = manager.nodes['dns.public' => true]
- expected = [{"domain_full"=>"ns1.#{domain}"}, {"domain_full"=>"ns2.#{domain}"}, {"domain_full"=>"vpn1.#{domain}"}, {"domain_full"=>"web1.#{domain}"}]
+ nodes = manager.nodes['x509.use' => true]
+ assert nodes.size != manager.nodes.size, 'should not return all nodes'
+ assert nodes.size > 2, 'should be some nodes'
+ expected = manager.nodes.collect {|name, node|
+ if node.x509.use
+ node.domain.full
+ end
+ }.compact
assert_equal expected.size, nodes.size
- assert_equal expected, nodes.fields('domain.full')
+ assert_equal expected.sort, nodes.field('domain.full').sort
end
+ def test_nodes_like_me
+ nodes = manager.nodes[:environment => nil]
+ node = nodes.values.first
+ assert nodes.size > 1, "should be nodes with no environment set"
+ assert_equal node.nodes_like_me.values, nodes.values
+ nodes = manager.nodes[:environment => "production"]
+ node = nodes.values.first
+ assert nodes.size > 1, "should be production nodes"
+ assert_equal node.nodes_like_me.values, nodes.values
+ end
end