Skip to content

Commit 6078bdf

Browse files
author
Dave Sims
committed
Test rejecting searches from different rootdn
1 parent 69f1e3b commit 6078bdf

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/forest_search_test.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,24 @@ def test_returns_concatenated_search_results_from_forest
7272
assert_equal results, ["entry1", "entry2"]
7373
end
7474

75+
def test_does_not_search_from_different_rootdn
76+
mock_domains = Object.new
77+
mock_domain_controller = Object.new
78+
79+
mock_dc_connection1 = Object.new
80+
mock_dc_connection2 = Object.new
81+
forest = {"DC=ad,DC=ghe,DC=local" => mock_dc_connection1,
82+
"DC=fu,DC=bar,DC=local" => mock_dc_connection2}
83+
84+
@connection.expects(:search).returns(mock_domains)
85+
mock_domains.expects(:each_with_object).returns(forest)
86+
87+
mock_dc_connection1.expects(:search).returns(["entry1"])
88+
mock_dc_connection2.expects(:search).never
89+
90+
base = "CN=user1,CN=Users,DC=ad,DC=ghe,DC=local"
91+
results = @forest_search.search({:base => base})
92+
assert_equal results, ["entry1"]
93+
end
94+
7595
end

0 commit comments

Comments
 (0)