Skip to content

Commit

Permalink
Add a test for X-ORIGIN
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Viktorin committed Oct 25, 2018
1 parent 7c22697 commit ebc12da
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Tests/t_ldap_schema_subentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import ldif
from ldap.ldapobject import SimpleLDAPObject
import ldap.schema
from ldap.schema.models import ObjectClass
from ldap.schema.models import ObjectClass, AttributeType
from slapdtest import SlapdTestCase, requires_ldapi

HERE = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -65,6 +65,22 @@ def test_urlfetch_file(self):
)


class TestXOrigin(unittest.TestCase):
def get_attribute_type(self, oid):
openldap_uri = 'file://{}'.format(TEST_SUBSCHEMA_FILES[1])
dn, schema = ldap.schema.urlfetch(openldap_uri)
return schema.get_obj(AttributeType, oid)

def test_origin_none(self):
self.assertEqual(
self.get_attribute_type('2.5.4.0').x_origin, None)

def test_origin_string(self):
self.assertEqual(
self.get_attribute_type('1.3.6.1.4.1.3401.8.2.8').x_origin,
'Pretty Good Privacy (PGP)')


class TestSubschemaUrlfetchSlapd(SlapdTestCase):
ldap_object_class = SimpleLDAPObject

Expand Down

0 comments on commit ebc12da

Please sign in to comment.