Skip to content

Commit ebc12da

Browse files
committed
Add a test for X-ORIGIN
1 parent 7c22697 commit ebc12da

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Tests/t_ldap_schema_subentry.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import ldif
1616
from ldap.ldapobject import SimpleLDAPObject
1717
import ldap.schema
18-
from ldap.schema.models import ObjectClass
18+
from ldap.schema.models import ObjectClass, AttributeType
1919
from slapdtest import SlapdTestCase, requires_ldapi
2020

2121
HERE = os.path.abspath(os.path.dirname(__file__))
@@ -65,6 +65,22 @@ def test_urlfetch_file(self):
6565
)
6666

6767

68+
class TestXOrigin(unittest.TestCase):
69+
def get_attribute_type(self, oid):
70+
openldap_uri = 'file://{}'.format(TEST_SUBSCHEMA_FILES[1])
71+
dn, schema = ldap.schema.urlfetch(openldap_uri)
72+
return schema.get_obj(AttributeType, oid)
73+
74+
def test_origin_none(self):
75+
self.assertEqual(
76+
self.get_attribute_type('2.5.4.0').x_origin, None)
77+
78+
def test_origin_string(self):
79+
self.assertEqual(
80+
self.get_attribute_type('1.3.6.1.4.1.3401.8.2.8').x_origin,
81+
'Pretty Good Privacy (PGP)')
82+
83+
6884
class TestSubschemaUrlfetchSlapd(SlapdTestCase):
6985
ldap_object_class = SimpleLDAPObject
7086

0 commit comments

Comments
 (0)