Class: TestLdif
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- TestLdif
- Defined in:
- vendor/plugins/ruby-net-ldap-0.0.4/tests/testldif.rb
Constant Summary
- TestLdifFilename =
"tests/testdata.ldif"
Instance Method Summary
- - (Object) test_empty_ldif
-
- (Object) test_ldif
TODO, INADEQUATE.
- - (Object) test_ldif_with_comments
- - (Object) test_ldif_with_continuation_lines
- - (Object) test_ldif_with_password
-
- (Object) test_to_ldif
TODO, need some tests.
Instance Method Details
- (Object) test_empty_ldif
20 21 22 23 |
# File 'vendor/plugins/ruby-net-ldap-0.0.4/tests/testldif.rb', line 20 def test_empty_ldif ds = Net::LDAP::Dataset::read_ldif( StringIO.new ) assert_equal( true, ds.empty? ) end |
- (Object) test_ldif
TODO, INADEQUATE. We need some more tests to verify the content.
49 50 51 52 53 54 |
# File 'vendor/plugins/ruby-net-ldap-0.0.4/tests/testldif.rb', line 49 def test_ldif File.open( TestLdifFilename, "r" ) {|f| ds = Net::LDAP::Dataset::read_ldif( f ) assert_equal( 13, ds.length ) } end |
- (Object) test_ldif_with_comments
25 26 27 28 29 30 |
# File 'vendor/plugins/ruby-net-ldap-0.0.4/tests/testldif.rb', line 25 def test_ldif_with_comments str = ["# Hello from LDIF-land", "# This is an unterminated comment"] io = StringIO.new( str[0] + "\r\n" + str[1] ) ds = Net::LDAP::Dataset::read_ldif( io ) assert_equal( str, ds.comments ) end |
- (Object) test_ldif_with_continuation_lines
42 43 44 45 |
# File 'vendor/plugins/ruby-net-ldap-0.0.4/tests/testldif.rb', line 42 def test_ldif_with_continuation_lines ds = Net::LDAP::Dataset::read_ldif( StringIO.new( "dn: abcdefg\r\n hijklmn\r\n\r\n" )) assert_equal( true, ds.has_key?( "abcdefg hijklmn" )) end |
- (Object) test_ldif_with_password
32 33 34 35 36 37 38 39 40 |
# File 'vendor/plugins/ruby-net-ldap-0.0.4/tests/testldif.rb', line 32 def test_ldif_with_password psw = "goldbricks" hashed_psw = "{SHA}" + Base64::encode64( SHA1.new(psw).digest ).chomp ldif_encoded = Base64::encode64( hashed_psw ).chomp ds = Net::LDAP::Dataset::read_ldif( StringIO.new( "dn: Goldbrick\r\nuserPassword:: #{ldif_encoded}\r\n\r\n" )) recovered_psw = ds["Goldbrick"][:userpassword].shift assert_equal( hashed_psw, recovered_psw ) end |
- (Object) test_to_ldif
TODO, need some tests. Must test folded lines and base64-encoded lines as well as normal ones.
58 59 60 61 62 63 64 |
# File 'vendor/plugins/ruby-net-ldap-0.0.4/tests/testldif.rb', line 58 def test_to_ldif File.open( TestLdifFilename, "r" ) {|f| ds = Net::LDAP::Dataset::read_ldif( f ) ds.to_ldif assert_equal( true, false ) # REMOVE WHEN WE HAVE SOME TESTS HERE. } end |