Skip to content

Commit 69f1e3b

Browse files
author
Dave Sims
committed
Test for concatenating search results
1 parent c06f0b0 commit 69f1e3b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/forest_search_test.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,23 @@ def test_iterates_over_domain_controllers_when_forest_present
5353
@forest_search.search({:base => base})
5454
end
5555

56+
def test_returns_concatenated_search_results_from_forest
57+
mock_domains = Object.new
58+
mock_domain_controller = Object.new
59+
60+
mock_dc_connection1 = Object.new
61+
mock_dc_connection2 = Object.new
62+
rootdn = "DC=ad,DC=ghe,DC=local"
63+
forest = [[rootdn, mock_dc_connection1],[rootdn, mock_dc_connection2]]
64+
65+
@connection.expects(:search).returns(mock_domains)
66+
mock_domains.expects(:each_with_object).returns(forest)
67+
68+
mock_dc_connection1.expects(:search).returns(["entry1"])
69+
mock_dc_connection2.expects(:search).returns(["entry2"])
70+
base = "CN=user1,CN=Users,DC=ad,DC=ghe,DC=local"
71+
results = @forest_search.search({:base => base})
72+
assert_equal results, ["entry1", "entry2"]
73+
end
74+
5675
end

0 commit comments

Comments
 (0)