test/ldap_test.rb in github-ldap-1.0.11 vs test/ldap_test.rb in github-ldap-1.0.12
- old
+ new
@@ -1,22 +1,12 @@
require 'test_helper'
-class GitHubLdapTest < Minitest::Test
+module GitHubLdapTestCases
def setup
- GitHub::Ldap.start_server
-
- @options = GitHub::Ldap.server_options.merge \
- host: 'localhost',
- uid: 'uid'
-
- @ldap = GitHub::Ldap.new(@options)
+ @ldap = GitHub::Ldap.new(options)
end
- def teardown
- GitHub::Ldap.stop_server
- end
-
def test_connection_with_default_options
assert @ldap.test_connection, "Ldap connection expected to succeed"
end
def test_simple_tls
@@ -30,15 +20,23 @@
assert_equal :start_tls, @ldap.check_encryption('TLS')
assert_equal :start_tls, @ldap.check_encryption(:start_tls)
end
def test_search_delegator
- user = @ldap.domain('dc=github,dc=com').valid_login? 'calavera', 'secret'
+ @ldap.domain('dc=github,dc=com').valid_login? 'calavera', 'secret'
result = @ldap.search(
{:base => 'dc=github,dc=com',
:attributes => %w(uid),
:filter => Net::LDAP::Filter.eq('uid', 'calavera')})
assert_equal 'calavera', result.first[:uid].first
end
+end
+
+class GitHubLdapTest < GitHub::Ldap::Test
+ include GitHubLdapTestCases
+end
+
+class GitHubLdapUnauthenticatedTest < GitHub::Ldap::UnauthenticatedTest
+ include GitHubLdapTestCases
end