comparison .svn/pristine/5b/5ba499ead951b0f7092a76c82d09ab18e9ef0b47.svn-base @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents
children
comparison
equal deleted inserted replaced
908:c6c2cbd0afee 909:cbb26bc654de
1 # $Id: testber.rb 57 2006-04-18 00:18:48Z blackhedd $
2 #
3 #
4
5
6 $:.unshift "lib"
7
8 require 'net/ldap'
9 require 'stringio'
10
11
12 class TestBer < Test::Unit::TestCase
13
14 def setup
15 end
16
17 # TODO: Add some much bigger numbers
18 # 5000000000 is a Bignum, which hits different code.
19 def test_ber_integers
20 assert_equal( "\002\001\005", 5.to_ber )
21 assert_equal( "\002\002\203t", 500.to_ber )
22 assert_equal( "\002\003\203\206P", 50000.to_ber )
23 assert_equal( "\002\005\222\320\227\344\000", 5000000000.to_ber )
24 end
25
26 def test_ber_parsing
27 assert_equal( 6, "\002\001\006".read_ber( Net::LDAP::AsnSyntax ))
28 assert_equal( "testing", "\004\007testing".read_ber( Net::LDAP::AsnSyntax ))
29 end
30
31
32 def test_ber_parser_on_ldap_bind_request
33 s = StringIO.new "0$\002\001\001`\037\002\001\003\004\rAdministrator\200\vad_is_bogus"
34 assert_equal( [1, [3, "Administrator", "ad_is_bogus"]], s.read_ber( Net::LDAP::AsnSyntax ))
35 end
36
37
38
39
40 end
41
42