mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
Revert "update notification rest tests"
This reverts commit 11919d9810.
This commit is contained in:
@@ -144,6 +144,7 @@ def send_notification_to_persist_queue(
|
|||||||
queue_name = "notify"
|
queue_name = "notify"
|
||||||
else:
|
else:
|
||||||
queue_name = queues[template_type]
|
queue_name = queues[template_type]
|
||||||
|
|
||||||
send_fn.apply_async(
|
send_fn.apply_async(
|
||||||
(
|
(
|
||||||
str(service.id),
|
str(service.id),
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
from datetime import datetime
|
|
||||||
from unittest.mock import ANY
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from flask import (json, current_app)
|
from flask import (json, current_app)
|
||||||
from freezegun import freeze_time
|
from freezegun import freeze_time
|
||||||
from notifications_python_client.authentication import create_jwt_token
|
from notifications_python_client.authentication import create_jwt_token
|
||||||
@@ -134,7 +133,6 @@ def test_send_notification_with_placeholders_replaced(notify_api, sample_email_t
|
|||||||
"something_encrypted",
|
"something_encrypted",
|
||||||
'2016-01-01T11:09:00.061258Z'
|
'2016-01-01T11:09:00.061258Z'
|
||||||
),
|
),
|
||||||
kwargs=ANY,
|
|
||||||
queue="db-email"
|
queue="db-email"
|
||||||
)
|
)
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
@@ -292,7 +290,6 @@ def test_should_allow_valid_sms_notification(notify_api, sample_template, mocker
|
|||||||
notification_id,
|
notification_id,
|
||||||
"something_encrypted",
|
"something_encrypted",
|
||||||
'2016-01-01T11:09:00.061258Z'),
|
'2016-01-01T11:09:00.061258Z'),
|
||||||
kwargs=ANY,
|
|
||||||
queue='db-sms')
|
queue='db-sms')
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
assert notification_id
|
assert notification_id
|
||||||
@@ -351,8 +348,8 @@ def test_should_allow_valid_email_notification(notify_api, sample_email_template
|
|||||||
notification_id,
|
notification_id,
|
||||||
"something_encrypted",
|
"something_encrypted",
|
||||||
'2016-01-01T11:00:00.000000Z'
|
'2016-01-01T11:00:00.000000Z'
|
||||||
|
|
||||||
),
|
),
|
||||||
kwargs=ANY,
|
|
||||||
queue="db-email"
|
queue="db-email"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -558,10 +555,6 @@ def test_should_send_email_if_team_api_key_and_a_service_user(notify_api, sample
|
|||||||
notification_id,
|
notification_id,
|
||||||
"something_encrypted",
|
"something_encrypted",
|
||||||
"2016-01-01T11:00:00.000000Z"),
|
"2016-01-01T11:00:00.000000Z"),
|
||||||
kwargs={
|
|
||||||
'api_key_id': str(api_key.id),
|
|
||||||
'key_type': KEY_TYPE_TEAM
|
|
||||||
},
|
|
||||||
queue='db-email'
|
queue='db-email'
|
||||||
)
|
)
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
@@ -601,10 +594,6 @@ def test_should_send_sms_to_anyone_with_test_key(
|
|||||||
notification_id = json.loads(response.data)['data']['notification']['id']
|
notification_id = json.loads(response.data)['data']['notification']['id']
|
||||||
app.celery.tasks.send_sms.apply_async.assert_called_once_with(
|
app.celery.tasks.send_sms.apply_async.assert_called_once_with(
|
||||||
(str(sample_template.service.id), notification_id, "something_encrypted", "2016-01-01T11:00:00.000000Z"),
|
(str(sample_template.service.id), notification_id, "something_encrypted", "2016-01-01T11:00:00.000000Z"),
|
||||||
kwargs={
|
|
||||||
'api_key_id': str(api_key.id),
|
|
||||||
'key_type': KEY_TYPE_TEST
|
|
||||||
},
|
|
||||||
queue='research-mode'
|
queue='research-mode'
|
||||||
)
|
)
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
@@ -646,10 +635,6 @@ def test_should_send_email_to_anyone_with_test_key(
|
|||||||
notification_id,
|
notification_id,
|
||||||
"something_encrypted",
|
"something_encrypted",
|
||||||
"2016-01-01T11:00:00.000000Z"),
|
"2016-01-01T11:00:00.000000Z"),
|
||||||
kwargs={
|
|
||||||
'api_key_id': str(api_key.id),
|
|
||||||
'key_type': KEY_TYPE_TEST
|
|
||||||
},
|
|
||||||
queue='research-mode'
|
queue='research-mode'
|
||||||
)
|
)
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
@@ -684,10 +669,6 @@ def test_should_send_sms_if_team_api_key_and_a_service_user(notify_api, sample_t
|
|||||||
notification_id,
|
notification_id,
|
||||||
"something_encrypted",
|
"something_encrypted",
|
||||||
"2016-01-01T11:00:00.000000Z"),
|
"2016-01-01T11:00:00.000000Z"),
|
||||||
kwargs={
|
|
||||||
'api_key_id': str(api_key.id),
|
|
||||||
'key_type': KEY_TYPE_TEAM
|
|
||||||
},
|
|
||||||
queue='db-sms'
|
queue='db-sms'
|
||||||
)
|
)
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
@@ -729,7 +710,6 @@ def test_should_persist_notification(notify_api, sample_template,
|
|||||||
|
|
||||||
mocked.assert_called_once_with(
|
mocked.assert_called_once_with(
|
||||||
(str(template.service.id), notification_id, "something_encrypted", '2016-01-01T11:00:00.000000Z'),
|
(str(template.service.id), notification_id, "something_encrypted", '2016-01-01T11:00:00.000000Z'),
|
||||||
kwargs=ANY,
|
|
||||||
queue='db-{}'.format(template_type))
|
queue='db-{}'.format(template_type))
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
|
|
||||||
@@ -1057,7 +1037,5 @@ def test_send_notification_uses_priority_queue_when_template_is_marked_as_priori
|
|||||||
|
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
mocked.assert_called_once_with(
|
mocked.assert_called_once_with(
|
||||||
(str(sample.service_id), notification_id, "something_encrypted", '2016-01-01T11:00:00.000000Z'),
|
(str(sample.service_id), notification_id, "something_encrypted", '2016-01-01T11:00:00.000000Z'), queue='notify'
|
||||||
kwargs=ANY,
|
|
||||||
queue='notify'
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
import uuid
|
import uuid
|
||||||
from unittest.mock import ANY
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from flask import json
|
from flask import json
|
||||||
from freezegun import freeze_time
|
|
||||||
|
|
||||||
from app.models import Notification
|
from app.models import Notification
|
||||||
|
|
||||||
from tests import create_authorization_header
|
from tests import create_authorization_header
|
||||||
from tests.app.conftest import sample_template as create_sample_template
|
from tests.app.conftest import sample_template as create_sample_template
|
||||||
|
from freezegun import freeze_time
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("reference", [None, "reference_from_client"])
|
@pytest.mark.parametrize("reference", [None, "reference_from_client"])
|
||||||
@@ -224,7 +220,5 @@ def test_send_notification_uses_priority_queue_when_template_is_marked_as_priori
|
|||||||
print(response.data)
|
print(response.data)
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
mocked.assert_called_once_with(
|
mocked.assert_called_once_with(
|
||||||
(str(sample.service_id), notification_id, 'something_encrypted', '2016-01-01T11:00:00.000000Z'),
|
(str(sample.service_id), notification_id, 'something_encrypted', '2016-01-01T11:00:00.000000Z'), queue='notify'
|
||||||
kwargs=ANY,
|
|
||||||
queue='notify'
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user