Commit 36aba16d authored by Lars Kruse's avatar Lars Kruse

Calendar Export Tests: verify export of private and public events

parent a867c958
......@@ -188,6 +188,14 @@ class GroupCalendarExportMember(memberships.AuthenticatedMemberMixin,
def create_group_event(self, **kwargs):
count_before = associations.Association.objects.count()'create-group-event',,
count_after = associations.Association.objects.count()
# verify that exactly one item was added
self.assertEqual(count_before + 1, count_after, "Failed to create item: {}".format(kwargs))
def get_calendar_export_url(self, is_public):
data = self.client.get(self.get_url('group-events-export', (, )))
if is_public:
......@@ -203,6 +211,24 @@ class GroupCalendarExportMember(memberships.AuthenticatedMemberMixin,
self.assertIn("token", calendar_export_url)
return calendar_export_url
def test_private_public_calendar_content(self):
""" verify that private and public events are only available in their calendars """
# create a private and a public event
self.create_group_event(title='Private Event', public=False)
self.create_group_event(title='Public Event', public=True)
# verify the content of the private calendar
calendar_url = self.get_calendar_export_url(False)
data = self.client.get(calendar_url).content.decode('utf8')
self.assertIn('BEGIN:VCALENDAR', data)
self.assertIn('Private Event', data)
self.assertNotIn('Public Event', data)
# verify the content of the public calendar
calendar_url = self.get_calendar_export_url(True)
data = self.client.get(calendar_url).content.decode('utf8')
self.assertIn('BEGIN:VCALENDAR', data)
self.assertNotIn('Private Event', data)
self.assertIn('Public Event', data)
def test_access_private_calendar(self):
""" test the (in)accessibility of a private calendar of a group for a logged in member """
private_url = self.get_calendar_export_url(False)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment