Skip to content

Commit

Permalink
fixed TestChangeRecords.test_simple() and added TestChangeRecords.tes…
Browse files Browse the repository at this point in the history
…t_simple_missing_dash()
  • Loading branch information
stroeder committed Jul 17, 2016
1 parent fa991f9 commit c97fe7f
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions Tests/t_ldif.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
See http://www.python-ldap.org/ for details.
$Id: t_ldif.py,v 1.18 2016/07/17 17:43:39 stroeder Exp $
$Id: t_ldif.py,v 1.19 2016/07/17 19:37:37 stroeder Exp $
"""

# from Python's standard lib
Expand Down Expand Up @@ -81,8 +81,9 @@ def check_records(
ignored_attr_types=ignored_attr_types,
max_entries=max_entries,
)
generated_ldif = self._unparse_records(records)
parsed_records2 = self._parse_records(
self._unparse_records(records),
generated_ldif,
ignored_attr_types=ignored_attr_types,
max_entries=max_entries,
)
Expand Down Expand Up @@ -435,6 +436,7 @@ def test_simple(self):
-
delete: attrib4
-
""",
[
(
Expand All @@ -445,10 +447,38 @@ def test_simple(self):
(ldif.MOD_OP_INTEGER['delete'], 'attrib3', [b'value']),
(ldif.MOD_OP_INTEGER['delete'], 'attrib4', None),
],
[],
None,
),
],
)

def test_missing_trailing_separator(self):
self.check_records(
"""
version: 1
dn: cn=x,cn=y,cn=z
changetype: modify
replace: attrib
attrib: value
attrib: value2
-
add: attrib2
attrib2: value
attrib2: value2
""",
[
(
'cn=x,cn=y,cn=z',
[
(ldif.MOD_OP_INTEGER['replace'], 'attrib', [b'value', b'value2']),
(ldif.MOD_OP_INTEGER['add'], 'attrib2', [b'value', b'value2']),
],
None,
),
],
)


if __name__ == '__main__':
unittest.main()

0 comments on commit c97fe7f

Please sign in to comment.