Skip to content

Commit cd35f1c

Browse files
committed
Test the stringification of X-ORIGIN in schema attributes
1 parent 7d1359c commit cd35f1c

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

Tests/t_ldap_schema_subentry.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,62 @@ def test_origin_multi_valued(self):
8686
self.get_attribute_type('1.3.6.1.4.1.11.1.3.1.1.3').x_origin,
8787
('RFC4876', 'user defined'))
8888

89+
def test_origin_none_str(self):
90+
"""Check string representation of an attribute without X-ORIGIN"""
91+
# This should check that the representation:
92+
# - does not contain X-ORIGIN, and
93+
# - is still syntactically valid.
94+
# Checking the full output makes the test simpler,
95+
# though might need to be adjusted in the future.
96+
self.assertEqual(
97+
str(self.get_attribute_type('2.16.840.1.113719.1.301.4.24.1')),
98+
(
99+
"( 2.16.840.1.113719.1.301.4.24.1 "
100+
+ "NAME 'krbHostServer' "
101+
+ "EQUALITY caseExactIA5Match "
102+
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )"
103+
),
104+
)
105+
106+
def test_origin_string_str(self):
107+
"""Check string representation of an attr with single-value X-ORIGIN"""
108+
# This should check that the representation:
109+
# - has the X-ORIGIN entry 'Netscape' with no parentheses, and
110+
# - is still syntactically valid.
111+
# Checking the full output makes the test simpler,
112+
# though might need to be adjusted in the future.
113+
self.assertEqual(
114+
str(self.get_attribute_type('2.16.840.1.113730.3.1.2091')),
115+
(
116+
"( 2.16.840.1.113730.3.1.2091 "
117+
+ "NAME 'nsslapd-suffix' "
118+
+ "DESC 'Netscape defined attribute type' "
119+
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
120+
+ "X-ORIGIN 'Netscape' )"
121+
),
122+
)
123+
124+
def test_origin_multi_valued_str(self):
125+
"""Check string representation of an attr with multi-value X-ORIGIN"""
126+
# This should check that the representation:
127+
# - has a parenthesized X-ORIGIN entry, and
128+
# - is still syntactically valid.
129+
# Checking the full output makes the test simpler,
130+
# though might need to be adjusted in the future.
131+
self.assertEqual(
132+
str(self.get_attribute_type('1.3.6.1.4.1.11.1.3.1.1.3')),
133+
(
134+
"( 1.3.6.1.4.1.11.1.3.1.1.3 NAME 'searchTimeLimit' "
135+
+ "DESC 'Maximum time an agent or service allows for a search "
136+
+ "to complete' "
137+
+ "EQUALITY integerMatch "
138+
+ "ORDERING integerOrderingMatch "
139+
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 "
140+
+ "SINGLE-VALUE "
141+
+ "X-ORIGIN ( 'RFC4876' 'user defined' ) )"
142+
),
143+
)
144+
89145

90146
class TestSubschemaUrlfetchSlapd(SlapdTestCase):
91147
ldap_object_class = SimpleLDAPObject

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy