Skip to content

Commit c186345

Browse files
committed
Test behavior of setting x_origin
1 parent cd35f1c commit c186345

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Tests/t_ldap_schema_subentry.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,24 @@ def test_origin_multi_valued_str(self):
142142
),
143143
)
144144

145+
def test_set_origin_str(self):
146+
"""Check that setting X-ORIGIN to a string makes entry unusable"""
147+
attr = self.get_attribute_type('2.16.840.1.113719.1.301.4.24.1')
148+
attr.x_origin = 'Netscape'
149+
self.assertRaises(AssertionError, str, attr)
150+
151+
def test_set_origin_list(self):
152+
"""Check that setting X-ORIGIN to a list makes entry unusable"""
153+
attr = self.get_attribute_type('2.16.840.1.113719.1.301.4.24.1')
154+
attr.x_origin = []
155+
self.assertRaises(AssertionError, str, attr)
156+
157+
def test_set_origin_tuple(self):
158+
"""Check that setting X-ORIGIN to a tuple works"""
159+
attr = self.get_attribute_type('2.16.840.1.113719.1.301.4.24.1')
160+
attr.x_origin = ('user defined',)
161+
self.assertIn(" X-ORIGIN 'user defined' ", str(attr))
162+
145163

146164
class TestSubschemaUrlfetchSlapd(SlapdTestCase):
147165
ldap_object_class = SimpleLDAPObject

0 commit comments

Comments
 (0)