mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-11 15:52:21 -05:00
fix tests
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
# import pytest
|
# import pytest
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
|
|
||||||
from app import aws_cloudwatch_client
|
from app import aws_cloudwatch_client
|
||||||
@@ -61,8 +63,9 @@ def test_check_sms_success(notify_api, mocker):
|
|||||||
|
|
||||||
message_id = "succeed"
|
message_id = "succeed"
|
||||||
notification_id = "ccc"
|
notification_id = "ccc"
|
||||||
|
created_at = datetime.utcnow()
|
||||||
with notify_api.app_context():
|
with notify_api.app_context():
|
||||||
aws_cloudwatch_client.check_sms(message_id, notification_id, 1000000000000)
|
aws_cloudwatch_client.check_sms(message_id, notification_id, created_at)
|
||||||
|
|
||||||
# We check the 'success' log group first and if we find the message_id, we are done, so there is only 1 call
|
# We check the 'success' log group first and if we find the message_id, we are done, so there is only 1 call
|
||||||
assert boto_mock.filter_log_events.call_count == 1
|
assert boto_mock.filter_log_events.call_count == 1
|
||||||
@@ -82,8 +85,9 @@ def test_check_sms_failure(notify_api, mocker):
|
|||||||
)
|
)
|
||||||
message_id = "fail"
|
message_id = "fail"
|
||||||
notification_id = "bbb"
|
notification_id = "bbb"
|
||||||
|
created_at = datetime.utcnow()
|
||||||
with notify_api.app_context():
|
with notify_api.app_context():
|
||||||
aws_cloudwatch_client.check_sms(message_id, notification_id, 1000000000000)
|
aws_cloudwatch_client.check_sms(message_id, notification_id, created_at)
|
||||||
|
|
||||||
# We check the 'success' log group and find nothing, so we then check the 'fail' log group -- two calls.
|
# We check the 'success' log group and find nothing, so we then check the 'fail' log group -- two calls.
|
||||||
assert boto_mock.filter_log_events.call_count == 2
|
assert boto_mock.filter_log_events.call_count == 2
|
||||||
|
|||||||
Reference in New Issue
Block a user