mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
Bump utils to 42.0.0
Requires unit test updating as we now expect broadcast event areas to be a dict containing a list of areas and simple polygons.
This commit is contained in:
@@ -4,7 +4,7 @@ from notifications_utils.statsd_decorators import statsd
|
|||||||
|
|
||||||
from app import notify_celery
|
from app import notify_celery
|
||||||
|
|
||||||
from app.dao.broadcast_message_dao import dao_get_broadcast_message_by_id, dao_get_broadcast_event_by_id
|
from app.dao.broadcast_message_dao import dao_get_broadcast_event_by_id
|
||||||
|
|
||||||
|
|
||||||
@notify_celery.task(name="send-broadcast-event")
|
@notify_celery.task(name="send-broadcast-event")
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ notifications-python-client==5.7.0
|
|||||||
# PaaS
|
# PaaS
|
||||||
awscli-cwlogs>=1.4,<1.5
|
awscli-cwlogs>=1.4,<1.5
|
||||||
|
|
||||||
git+https://github.com/alphagov/notifications-utils.git@41.3.1#egg=notifications-utils==41.3.1
|
git+https://github.com/alphagov/notifications-utils.git@42.0.0#egg=notifications-utils==42.0.0
|
||||||
|
|
||||||
# gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains
|
# gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains
|
||||||
prometheus-client==0.8.0
|
prometheus-client==0.8.0
|
||||||
|
|||||||
@@ -31,25 +31,25 @@ notifications-python-client==5.7.0
|
|||||||
# PaaS
|
# PaaS
|
||||||
awscli-cwlogs>=1.4,<1.5
|
awscli-cwlogs>=1.4,<1.5
|
||||||
|
|
||||||
git+https://github.com/alphagov/notifications-utils.git@41.3.1#egg=notifications-utils==41.3.1
|
git+https://github.com/alphagov/notifications-utils.git@42.0.0#egg=notifications-utils==42.0.0
|
||||||
|
|
||||||
# gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains
|
# gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains
|
||||||
prometheus-client==0.8.0
|
prometheus-client==0.8.0
|
||||||
gds-metrics==0.2.4
|
gds-metrics==0.2.4
|
||||||
|
|
||||||
## The following requirements were added by pip freeze:
|
## The following requirements were added by pip freeze:
|
||||||
alembic==1.4.2
|
alembic==1.4.3
|
||||||
amqp==1.4.9
|
amqp==1.4.9
|
||||||
anyjson==0.3.3
|
anyjson==0.3.3
|
||||||
attrs==20.2.0
|
attrs==20.2.0
|
||||||
awscli==1.18.135
|
awscli==1.18.137
|
||||||
bcrypt==3.2.0
|
bcrypt==3.2.0
|
||||||
billiard==3.3.0.23
|
billiard==3.3.0.23
|
||||||
bleach==3.1.4
|
bleach==3.1.4
|
||||||
blinker==1.4
|
blinker==1.4
|
||||||
boto==2.49.0
|
boto==2.49.0
|
||||||
boto3==1.10.38
|
boto3==1.10.38
|
||||||
botocore==1.17.58
|
botocore==1.17.60
|
||||||
certifi==2020.6.20
|
certifi==2020.6.20
|
||||||
chardet==3.0.4
|
chardet==3.0.4
|
||||||
click==7.1.2
|
click==7.1.2
|
||||||
@@ -76,7 +76,7 @@ phonenumbers==8.11.2
|
|||||||
pyasn1==0.4.8
|
pyasn1==0.4.8
|
||||||
pycparser==2.20
|
pycparser==2.20
|
||||||
PyPDF2==1.26.0
|
PyPDF2==1.26.0
|
||||||
pyrsistent==0.16.0
|
pyrsistent==0.17.3
|
||||||
python-dateutil==2.8.1
|
python-dateutil==2.8.1
|
||||||
python-editor==1.0.4
|
python-editor==1.0.4
|
||||||
python-json-logger==0.1.11
|
python-json-logger==0.1.11
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ def test_update_broadcast_message_allows_edit_while_not_yet_live(admin_request,
|
|||||||
_data={
|
_data={
|
||||||
'starts_at': '2020-06-01 20:00:01',
|
'starts_at': '2020-06-01 20:00:01',
|
||||||
'areas': ['london', 'glasgow'],
|
'areas': ['london', 'glasgow'],
|
||||||
"simple_polygons": [[51.12, 0.2], [50.13, 0.4], [50.14, 0.45]]
|
"simple_polygons": [[[51.12, 0.2], [50.13, 0.4], [50.14, 0.45]]]
|
||||||
},
|
},
|
||||||
service_id=t.service_id,
|
service_id=t.service_id,
|
||||||
broadcast_message_id=bm.id,
|
broadcast_message_id=bm.id,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import pytest
|
|||||||
import requests_mock
|
import requests_mock
|
||||||
from requests import RequestException
|
from requests import RequestException
|
||||||
|
|
||||||
from app.dao.templates_dao import dao_update_template
|
|
||||||
from app.models import BROADCAST_TYPE, BroadcastStatusType, BroadcastEventMessageType
|
from app.models import BROADCAST_TYPE, BroadcastStatusType, BroadcastEventMessageType
|
||||||
from app.celery.broadcast_message_tasks import send_broadcast_event
|
from app.celery.broadcast_message_tasks import send_broadcast_event
|
||||||
from tests.app.db import create_template, create_broadcast_message, create_broadcast_event
|
from tests.app.db import create_template, create_broadcast_message, create_broadcast_event
|
||||||
@@ -12,7 +11,11 @@ from tests.app.db import create_template, create_broadcast_message, create_broad
|
|||||||
@freeze_time('2020-08-01 12:00')
|
@freeze_time('2020-08-01 12:00')
|
||||||
def test_send_broadcast_event_sends_data_correctly(sample_service):
|
def test_send_broadcast_event_sends_data_correctly(sample_service):
|
||||||
template = create_template(sample_service, BROADCAST_TYPE)
|
template = create_template(sample_service, BROADCAST_TYPE)
|
||||||
broadcast_message = create_broadcast_message(template, areas=['london'], status=BroadcastStatusType.BROADCASTING)
|
broadcast_message = create_broadcast_message(
|
||||||
|
template,
|
||||||
|
areas={"areas": ['london'], "simple_polygons": [[[50.12, 1.2], [50.13, 1.2], [50.14, 1.21]]]},
|
||||||
|
status=BroadcastStatusType.BROADCASTING
|
||||||
|
)
|
||||||
event = create_broadcast_event(broadcast_message)
|
event = create_broadcast_event(broadcast_message)
|
||||||
|
|
||||||
with requests_mock.Mocker() as request_mock:
|
with requests_mock.Mocker() as request_mock:
|
||||||
@@ -28,7 +31,9 @@ def test_send_broadcast_event_sends_data_correctly(sample_service):
|
|||||||
assert cbc_json['broadcast_message_id'] == str(broadcast_message.id)
|
assert cbc_json['broadcast_message_id'] == str(broadcast_message.id)
|
||||||
assert cbc_json['sent_at'] == '2020-08-01T12:00:00.000000Z'
|
assert cbc_json['sent_at'] == '2020-08-01T12:00:00.000000Z'
|
||||||
assert cbc_json['transmitted_starts_at'] is None
|
assert cbc_json['transmitted_starts_at'] is None
|
||||||
assert cbc_json['transmitted_areas'] == ['london']
|
assert cbc_json['transmitted_areas'] == {
|
||||||
|
"areas": ['london'], "simple_polygons": [[[50.12, 1.2], [50.13, 1.2], [50.14, 1.21]]]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_send_broadcast_event_sends_references(sample_service):
|
def test_send_broadcast_event_sends_references(sample_service):
|
||||||
|
|||||||
@@ -1040,7 +1040,9 @@ def create_broadcast_event(
|
|||||||
sent_at=sent_at or datetime.utcnow(),
|
sent_at=sent_at or datetime.utcnow(),
|
||||||
message_type=message_type,
|
message_type=message_type,
|
||||||
transmitted_content=transmitted_content or {'body': 'this is an emergency broadcast message'},
|
transmitted_content=transmitted_content or {'body': 'this is an emergency broadcast message'},
|
||||||
transmitted_areas=transmitted_areas or ['london'],
|
transmitted_areas=transmitted_areas or {
|
||||||
|
'areas': ['london'], 'simple_polygons': [[[50.12, 1.2], [50.13, 1.2], [50.14, 1.21]]]
|
||||||
|
},
|
||||||
transmitted_sender=transmitted_sender or 'www.notifications.service.gov.uk',
|
transmitted_sender=transmitted_sender or 'www.notifications.service.gov.uk',
|
||||||
transmitted_starts_at=transmitted_starts_at,
|
transmitted_starts_at=transmitted_starts_at,
|
||||||
transmitted_finishes_at=transmitted_finishes_at or datetime.utcnow(),
|
transmitted_finishes_at=transmitted_finishes_at or datetime.utcnow(),
|
||||||
|
|||||||
Reference in New Issue
Block a user