Test format of Global Catalog search results

This commit is contained in:
Dave Sims 2016-07-25 10:08:17 -05:00
Родитель 203063d6e6
Коммит a23ccef696
1 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -1,4 +1,5 @@
require_relative 'test_helper'
require 'mocha/mini_test'
module GitHubLdapTestCases
def setup
@ -118,6 +119,23 @@ module GitHubLdapTestCases
assert_kind_of Net::LDAP::Entry, @ldap.capabilities
end
def test_global_catalog_returns_empty_array_for_no_results
mock_global_catalog_connection = Object.new
mock_global_catalog_connection.expects(:search).returns(nil)
Net::LDAP.expects(:new).returns(mock_global_catalog_connection)
results = @ldap.global_catalog_search({})
assert_equal [], results
end
def test_global_catalog_returns_array_of_results
mock_global_catalog_connection = Object.new
stub_entry = Object.new
mock_global_catalog_connection.expects(:search).returns(stub_entry)
Net::LDAP.expects(:new).returns(mock_global_catalog_connection)
results = @ldap.global_catalog_search({})
assert_equal [stub_entry], results
end
module GitHubLdapUnauthenticatedTestCases
def test_global_catalog_default_settings
global_catalog = @ldap.global_catalog_connection