Skip to content

Commit 856269b

Browse files
committed
Strip the DTSTAMP value from ical before comparing them. Fixes #380
1 parent d60c0f9 commit 856269b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/test_vcal.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,17 @@ def assertSameICal(self, ical1, ical2, ignore_uid=False):
4040
"""helper method"""
4141

4242
def normalize(s, ignore_uid):
43+
## TODO: This may break in case of line wrappings
44+
## We're explicitly not using any libraries for this, as it may skew the test
4345
s = to_wire(s).replace(b"\r\n", b"\n").strip().split(b"\n")
4446
s.sort()
4547
if ignore_uid:
4648
s = [x for x in s if not x.startswith(b"UID:")]
49+
## ref https://github.com/python-caldav/caldav/issues/380
50+
for i in range(0, len(s)):
51+
## We cut the value itself, just asserting the attribute is present
52+
if s[i].startswith(b'DTSTAMP'):
53+
s[i] = s[i][:9]
4754
return b"\n".join(s)
4855

4956
self.assertEqual(normalize(ical1, ignore_uid), normalize(ical2, ignore_uid))

0 commit comments

Comments
 (0)