예제 #1
0
 def test_parse_dn_multi(self):
     parsed = p('cn=user1,ou=users,dc=branch,dc=company,c=IT')
     self.assertEqual(len(parsed), 5)
     self.assertEqual(parsed[0], ('cn', 'user1', ','))
     self.assertEqual(parsed[1], ('ou', 'users', ','))
     self.assertEqual(parsed[2], ('dc', 'branch', ','))
     self.assertEqual(parsed[3], ('dc', 'company', ','))
     self.assertEqual(parsed[4], ('c', 'IT', ''))
예제 #2
0
 def test_parse_dn_escaped_multi(self):
     parsed = p('cn=us\\,er1,ou=us\\08ers,dc=br\\,anch,dc=company,c=IT')
     self.assertEqual(len(parsed), 5)
     self.assertEqual(parsed[0], ('cn', 'us\\,er1', ','))
     self.assertEqual(parsed[1], ('ou', 'us\\08ers', ','))
     self.assertEqual(parsed[2], ('dc', 'br\\,anch', ','))
     self.assertEqual(parsed[3], ('dc', 'company', ','))
     self.assertEqual(parsed[4], ('c', 'IT', ''))
예제 #3
0
 def test_parse_dn_unescaped_multi(self):
     parsed = p('cn=us,er1,ou=use<rs,dc=br+anch,dc=company,c=IT', escape=True)
     self.assertEqual(len(parsed), 5)
     self.assertEqual(parsed[0], ('cn', 'us\\,er1', ','))
     self.assertEqual(parsed[1], ('ou', 'use\\<rs', ','))
     self.assertEqual(parsed[2], ('dc', 'br\\+anch', ','))
     self.assertEqual(parsed[3], ('dc', 'company', ','))
     self.assertEqual(parsed[4], ('c', 'IT', ''))
예제 #4
0
 def test_parse_dn_escaped_multi_type(self):
     parsed = p('cn=us\\+er1+sn=su\\,rname1,o=users')
     self.assertEqual(len(parsed), 3)
     self.assertEqual(parsed[0], ('cn', 'us\\+er1', '+'))
     self.assertEqual(parsed[1], ('sn', 'su\\,rname1', ','))
     self.assertEqual(parsed[2], ('o', 'users', ''))
예제 #5
0
 def test_parse_dn_escaped_double_1(self):
     parsed = p('cn=\\\\,o=\\\\')
     self.assertEqual(len(parsed), 2)
     self.assertEqual(parsed[0], ('cn', '\\\\', ','))
     self.assertEqual(parsed[1], ('o', '\\\\', ''))
예제 #6
0
 def test_parse_dn_escaped_double(self):
     parsed = p('cn=us\\=er1,o=us\\,ers')
     self.assertEqual(len(parsed), 2)
     self.assertEqual(parsed[0], ('cn', 'us\\=er1', ','))
     self.assertEqual(parsed[1], ('o', 'us\\,ers', ''))
예제 #7
0
 def test_parse_dn_escaped_single(self):
     parsed = p('cn=admi\\,n')
     self.assertEqual(len(parsed), 1)
     self.assertEqual(parsed[0], ('cn', 'admi\\,n', ''))
예제 #8
0
 def test_parse_dn_escaped_single_multi_rdn(self):
     parsed = p('cn=\\\\\\[email protected]')
     self.assertEqual(len(parsed), 2)
     self.assertEqual(parsed[0], ('cn', '\\\\\\+admin', '+'))
     self.assertEqual(parsed[1], ('email', '*****@*****.**', ''))
예제 #9
0
 def _test_parse_dn(self, input, expected):
     parsed = p(input, escape=False)
     self.assertEqual(parsed, expected)
예제 #10
0
 def test_parse_dn_unescaped_double(self):
     parsed = p('cn=us=er1,o=us,ers', escape=True)
     self.assertEqual(len(parsed), 2)
     self.assertEqual(parsed[0], ('cn', 'us\\=er1', ','))
     self.assertEqual(parsed[1], ('o', 'us\\,ers', ''))
예제 #11
0
 def test_parse_dn_unescaped_single(self):
     parsed = p('cn=admi,n', escape=True)
     self.assertEqual(len(parsed), 1)
     self.assertEqual(parsed[0], ('cn', 'admi\\,n', ''))
예제 #12
0
 def test_parse_dn_escaped_multi_type(self):
     parsed = p('cn=us\\+er1+sn=su\\,rname1,o=users')
     self.assertEqual(len(parsed), 3)
     self.assertEqual(parsed[0], ('cn', 'us\\+er1', '+'))
     self.assertEqual(parsed[1], ('sn', 'su\\,rname1', ','))
     self.assertEqual(parsed[2], ('o', 'users', ''))
예제 #13
0
 def test_parse_dn_double(self):
     parsed = p('cn=user1,o=users')
     self.assertEqual(len(parsed), 2)
     self.assertEqual(parsed[0], ('cn', 'user1', ','))
     self.assertEqual(parsed[1], ('o', 'users', ''))
예제 #14
0
 def test_parse_dn_single(self):
     parsed = p('cn=admin')
     self.assertEqual(len(parsed), 1)
     self.assertEqual(parsed[0], ('cn', 'admin', ''))