-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
2 changed files
with
54 additions
and
6 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
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 |
---|---|---|
|
@@ -108,3 +108,41 @@ def test_get_email_reputation_failure_quota_limit(self, requests_mock, client: C | |
with pytest.raises(DemistoException): | ||
client.get_email_reputation('[email protected]') | ||
assert client.execution_metrics.quota_error == 1 | ||
|
||
def test_get_email_reputation_failure_auth_error(self, requests_mock, client: Client): | ||
""" | ||
Given: | ||
a Client instance and a mocked failed auth limit API response | ||
When: | ||
get_email_reputation is called with a valid email address | ||
Then: | ||
- a DemistoException is raised | ||
- matrix auth_error increased | ||
""" | ||
requests_mock.get( | ||
'https://test.com/v3/more/json/test/[email protected]', | ||
status_code=401, | ||
) | ||
|
||
with pytest.raises(DemistoException): | ||
client.get_email_reputation('[email protected]') | ||
assert client.execution_metrics.auth_error == 1 | ||
|
||
def test_get_email_reputation_failure_general_error(self, requests_mock, client: Client): | ||
""" | ||
Given: | ||
a Client instance and a mocked 400 API response | ||
When: | ||
get_email_reputation is called with a valid email address | ||
Then: | ||
- a DemistoException is raised | ||
- matrix general_error increased | ||
""" | ||
requests_mock.get( | ||
'https://test.com/v3/more/json/test/[email protected]', | ||
status_code=400, | ||
) | ||
|
||
with pytest.raises(DemistoException): | ||
client.get_email_reputation('[email protected]') | ||
assert client.execution_metrics.general_error == 1 |