-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add pagerduty migrator test + fix linting (#5378)
- Loading branch information
1 parent
54ff63a
commit 2503eaf
Showing
2 changed files
with
30 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from unittest.mock import call, patch | ||
|
||
from lib.pagerduty.migrate import migrate | ||
|
||
|
||
@patch("lib.pagerduty.migrate.MIGRATE_USERS", False) | ||
@patch("lib.pagerduty.migrate.APISession") | ||
@patch("lib.pagerduty.migrate.OnCallAPIClient") | ||
def test_users_are_skipped_when_migrate_users_is_false( | ||
MockOnCallAPIClient, MockAPISession | ||
): | ||
mock_session = MockAPISession.return_value | ||
mock_session.list_all.return_value = [] | ||
mock_oncall_client = MockOnCallAPIClient.return_value | ||
|
||
migrate() | ||
|
||
# Assert no user-related fetching or migration occurs | ||
assert mock_session.list_all.call_args_list == [ | ||
call("schedules", params={"include[]": "schedule_layers", "time_zone": "UTC"}), | ||
call("escalation_policies"), | ||
call("services", params={"include[]": "integrations"}), | ||
call("vendors"), | ||
# no user notification rules fetching | ||
] | ||
|
||
mock_oncall_client.list_users_with_notification_rules.assert_not_called() |