From c186345d6846bcf1738ac752540964ccd37bcd0f Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 4 Jan 2019 16:37:16 +0100 Subject: [PATCH] Test behavior of setting x_origin --- Tests/t_ldap_schema_subentry.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Tests/t_ldap_schema_subentry.py b/Tests/t_ldap_schema_subentry.py index fd006a7..2baea16 100644 --- a/Tests/t_ldap_schema_subentry.py +++ b/Tests/t_ldap_schema_subentry.py @@ -142,6 +142,24 @@ def test_origin_multi_valued_str(self): ), ) + def test_set_origin_str(self): + """Check that setting X-ORIGIN to a string makes entry unusable""" + attr = self.get_attribute_type('2.16.840.1.113719.1.301.4.24.1') + attr.x_origin = 'Netscape' + self.assertRaises(AssertionError, str, attr) + + def test_set_origin_list(self): + """Check that setting X-ORIGIN to a list makes entry unusable""" + attr = self.get_attribute_type('2.16.840.1.113719.1.301.4.24.1') + attr.x_origin = [] + self.assertRaises(AssertionError, str, attr) + + def test_set_origin_tuple(self): + """Check that setting X-ORIGIN to a tuple works""" + attr = self.get_attribute_type('2.16.840.1.113719.1.301.4.24.1') + attr.x_origin = ('user defined',) + self.assertIn(" X-ORIGIN 'user defined' ", str(attr)) + class TestSubschemaUrlfetchSlapd(SlapdTestCase): ldap_object_class = SimpleLDAPObject