mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 05:29:38 -04:00
Show inbound messages on the dashboard
This commit adds two things: a section on the dashboard to show how many inbound messages the service has received in the last 7 days, and how recently an inbound message has been received --- Doesn’t show the contents of any messages, just like how the rest of the dashboard is an aggregation, never individual messages. a page to show all the inbound messages the service has received in the last 7 days --- This shows the first line of the message. Eventually this will link through to a ‘conversation’ page, where a service can see all the messages it’s received from a given phone number.
This commit is contained in:
@@ -1132,6 +1132,68 @@ def mock_get_notifications_with_no_notifications(mocker):
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_inbound_sms(mocker):
|
||||
def _get_inbound_sms(
|
||||
service_id,
|
||||
):
|
||||
return [{
|
||||
'user_number': '0790090000' + str(i),
|
||||
'content': 'foo',
|
||||
'created_at': (datetime.utcnow() - timedelta(minutes=60 * (i + 1))).isoformat()
|
||||
} for i in range(5)]
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_inbound_sms',
|
||||
side_effect=_get_inbound_sms,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_inbound_sms_with_no_messages(mocker):
|
||||
def _get_inbound_sms(
|
||||
service_id,
|
||||
):
|
||||
return []
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_inbound_sms',
|
||||
side_effect=_get_inbound_sms,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_inbound_sms_summary(mocker):
|
||||
def _get_inbound_sms_summary(
|
||||
service_id,
|
||||
):
|
||||
return {
|
||||
'count': 99,
|
||||
'latest_message': datetime.utcnow().isoformat()
|
||||
}
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_inbound_sms_summary',
|
||||
side_effect=_get_inbound_sms_summary,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_inbound_sms_summary_with_no_messages(mocker):
|
||||
def _get_inbound_sms_summary(
|
||||
service_id,
|
||||
):
|
||||
return {
|
||||
'count': 0,
|
||||
'latest_message': None
|
||||
}
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_inbound_sms_summary',
|
||||
side_effect=_get_inbound_sms_summary,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_has_permissions(mocker):
|
||||
def _has_permission(permissions=None, any_=False, admin_override=False):
|
||||
|
||||
Reference in New Issue
Block a user