Skip to content

Commit

Permalink
ch(Tests) Test event status updates if event has no attendees (#275)
Browse files Browse the repository at this point in the history
- Test that the event status on calendar is updated even if the event has no attendees

[Finishes #168261994]
  • Loading branch information
MandelaK authored and andrewinsoul committed Sep 12, 2019
1 parent 441a67b commit 3fc9669
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions server/graphql_schemas/tests/utils/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
from graphql_schemas.utils.helpers import update_event_status_on_calendar, remove_event_from_all_calendars
from api.tests.base_test_setup import BaseSetup


class HelperTests(BaseSetup):
"""
Tests the helper functions and methods
"""

def test_update_event_status_on_calendar(self):
"""
Test method that update the event status on calendar
Expand All @@ -29,6 +31,25 @@ def test_update_event_status_on_calendar(self):
self.assertEqual(mock_build.call_count, 2)
mock_build_patcher.stop()

def test_udpate_event_status_if_there_are_no_attendees(self):
"""
Test that event status on calendars is updated
if there are no initial attendees for the event
"""

mock_build_patcher = patch('graphql_schemas.utils.helpers.build')
user, event = self.andela_user1, self.event_1
mock_build = mock_build_patcher.start()
# the mocked return value does not have the `attendees` list
mock_build.return_value.events.return_value.get.return_value.execute.return_value = {}
mock_build.return_value.events.return_value.patch.return_value.execute.return_value = 'event updated'
update_event_status_on_calendar(user, event)
self.assertEqual(mock_build.called, True)
self.assertEqual(mock_build.return_value.events.return_value.patch.called, True)
self.assertEqual(mock_build.return_value.events.return_value.get.called, True)
self.assertEqual(mock_build.call_count, 2)
mock_build_patcher.stop()

def test_remove_event_from_all_calendar(self):
"""
Test method that update the event status on calendar
Expand Down

0 comments on commit 3fc9669

Please sign in to comment.