-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create the basic directories and files needed for unittest.
- Loading branch information
1 parent
4e7d058
commit b28eca7
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,20 @@ | ||
from unittest.mock import MagicMock, patch | ||
|
||
from structs.alertmanager.silence_details import SilenceDetails | ||
from alertmanager_api.silence import AlertManagerAPI | ||
|
||
|
||
@patch("alertmanager_api.silence.requests.post") | ||
def test_schedule_silence_sucess(mock_post): | ||
alertmanager_account = MagicMock() | ||
class_instance = AlertManagerAPI(alertmanager_account) | ||
|
||
silence = SilenceDetails("hostname", "starttitme", "endtime", "author", "comment") | ||
|
||
mock_response = MagicMock() | ||
mock_response.status_code = 201 | ||
mock_post.return_value = mock_response | ||
|
||
class_instance.schedule_silence(silence) | ||
|
||
mock_post.assert_called_once() |