generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
1 addition
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
"""Unit tests for schedule_retro module in Incident management proces.""" | ||
|
||
import json | ||
from unittest.mock import patch, MagicMock | ||
from unittest.mock import patch | ||
from datetime import datetime, timedelta | ||
import pytest | ||
import pytz | ||
|
||
# from integrations.google_workspace import google_calendar | ||
from modules.incident import schedule_retro | ||
|
||
# Mocked dependencies | ||
SRE_BOT_EMAIL = "[email protected]" | ||
SCOPES = ["https://www.googleapis.com/auth/calendar"] | ||
|
||
|
||
# Fixture to mock the event details JSON string | ||
@pytest.fixture | ||
|
@@ -25,20 +21,6 @@ def event_details(): | |
) | ||
|
||
|
||
# Fixture to mock the calendar service object | ||
@pytest.fixture | ||
def calendar_service_mock(): | ||
# Mock for the Google Calendar service object | ||
service_mock = MagicMock() | ||
|
||
# Properly set the return value for the execute method to return the expected dictionary directly | ||
service_mock.events.return_value.insert.return_value.execute.return_value = { | ||
"htmlLink": "https://calendar.google.com/event_link" | ||
} | ||
|
||
return service_mock | ||
|
||
|
||
# Fixture to mock the timezone | ||
@pytest.fixture | ||
def est_timezone(): | ||
|
@@ -62,12 +44,6 @@ def mock_datetime_now(est_timezone): | |
yield mock_datetime | ||
|
||
|
||
# Fixture to mock the list of calendars | ||
@pytest.fixture | ||
def items(): | ||
return [{"id": "calendar1"}, {"id": "calendar2"}] | ||
|
||
|
||
# Test out the schedule_event function is successful | ||
@patch("modules.incident.schedule_retro.get_freebusy") | ||
@patch("modules.incident.schedule_retro.find_first_available_slot") | ||
|