Skip to content

Commit

Permalink
Test the stringification of X-ORIGIN in schema attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Viktorin committed Jan 4, 2019
1 parent 7d1359c commit cd35f1c
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions Tests/t_ldap_schema_subentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,62 @@ def test_origin_multi_valued(self):
self.get_attribute_type('1.3.6.1.4.1.11.1.3.1.1.3').x_origin,
('RFC4876', 'user defined'))

def test_origin_none_str(self):
"""Check string representation of an attribute without X-ORIGIN"""
# This should check that the representation:
# - does not contain X-ORIGIN, and
# - is still syntactically valid.
# Checking the full output makes the test simpler,
# though might need to be adjusted in the future.
self.assertEqual(
str(self.get_attribute_type('2.16.840.1.113719.1.301.4.24.1')),
(
"( 2.16.840.1.113719.1.301.4.24.1 "
+ "NAME 'krbHostServer' "
+ "EQUALITY caseExactIA5Match "
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )"
),
)

def test_origin_string_str(self):
"""Check string representation of an attr with single-value X-ORIGIN"""
# This should check that the representation:
# - has the X-ORIGIN entry 'Netscape' with no parentheses, and
# - is still syntactically valid.
# Checking the full output makes the test simpler,
# though might need to be adjusted in the future.
self.assertEqual(
str(self.get_attribute_type('2.16.840.1.113730.3.1.2091')),
(
"( 2.16.840.1.113730.3.1.2091 "
+ "NAME 'nsslapd-suffix' "
+ "DESC 'Netscape defined attribute type' "
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
+ "X-ORIGIN 'Netscape' )"
),
)

def test_origin_multi_valued_str(self):
"""Check string representation of an attr with multi-value X-ORIGIN"""
# This should check that the representation:
# - has a parenthesized X-ORIGIN entry, and
# - is still syntactically valid.
# Checking the full output makes the test simpler,
# though might need to be adjusted in the future.
self.assertEqual(
str(self.get_attribute_type('1.3.6.1.4.1.11.1.3.1.1.3')),
(
"( 1.3.6.1.4.1.11.1.3.1.1.3 NAME 'searchTimeLimit' "
+ "DESC 'Maximum time an agent or service allows for a search "
+ "to complete' "
+ "EQUALITY integerMatch "
+ "ORDERING integerOrderingMatch "
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 "
+ "SINGLE-VALUE "
+ "X-ORIGIN ( 'RFC4876' 'user defined' ) )"
),
)


class TestSubschemaUrlfetchSlapd(SlapdTestCase):
ldap_object_class = SimpleLDAPObject
Expand Down

0 comments on commit cd35f1c

Please sign in to comment.