Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test coverage of tencentsms.py #479

Merged
merged 7 commits into from
Sep 23, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint
  • Loading branch information
v_connliu committed Sep 23, 2021
commit fcf835911b6e9d40dec21a7e565608d3cd66d31f
27 changes: 0 additions & 27 deletions tests/alerters/tencentsms_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import logging
import pytest
from unittest import mock
Expand Down Expand Up @@ -237,29 +236,3 @@ def test_tencentsms_alert_secret_id_error(caplog):
alert = TencentSMSAlerter(rule)
alert.alert([match])
assert 'The SecretId is not found' in str(ea)


def test_tencentsms_alert_secret_id_error(caplog):
caplog.set_level(logging.DEBUG)
with pytest.raises(EAException) as ea:
rule = {
'name': 'Test tencentsms Template Parm',
'type': 'any',
'alert': ["tencent_sms"],
"tencent_sms_secret_id": "secret_id",
"tencent_sms_secret_key": "secret_key",
"tencent_sms_sdk_appid": "1400006666",
"tencent_sms_to_number": [
"+8613711112222"
],
"tencent_sms_template_id": "1123835",
}
match = {
'@timestamp': '2014-01-01T00:00:00',
"message": "2021-09-03T14:34:08+0000|INFO|vector eps : 192.168.0.2:10000,",
}
rules_loader = FileRulesLoader({})
rules_loader.load_modules(rule)
alert = TencentSMSAlerter(rule)
alert.alert([match])
assert 'The SecretId is not found' in str(ea)