Skip to content

Commit 879fd51

Browse files
committed
Add basic integration tests for bind
1 parent 0abd796 commit 879fd51

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/test_integration.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
require_relative 'test_helper'
2+
3+
if !INTEGRATION
4+
puts "Skipping integration tests..."
5+
else
6+
class TestLDAPInstrumentation < Test::Unit::TestCase
7+
def setup
8+
@service = MockInstrumentationService.new
9+
@ldap = Net::LDAP.new \
10+
host: 'localhost',
11+
port: 389,
12+
admin_user: 'uid=admin,dc=rubyldap,dc=com',
13+
admin_password: 'passworD1',
14+
search_domains: %w(dc=rubyldap,dc=com),
15+
uid: 'uid',
16+
instrumentation_service: @service
17+
end
18+
19+
def test_bind_success
20+
assert @ldap.bind(method: :simple, username: "user1", password: "passworD1")
21+
end
22+
23+
def test_bind_success_anonymous
24+
assert @ldap.bind(method: :simple, username: "user1", password: "")
25+
end
26+
27+
def test_bind_fail
28+
refute @ldap.bind(method: :simple, username: "user1", password: "not my password")
29+
end
30+
end
31+
end

0 commit comments

Comments
 (0)