Make inbox page update using AJAX

Fairly self-explanatory. Uses the same pattern of breaking things up
into functions as the jobs page.
This commit is contained in:
Chris Hill-Scott
2017-07-07 15:51:59 +01:00
parent dc3f26a646
commit 5f6351762a
4 changed files with 90 additions and 39 deletions

View File

@@ -1,3 +1,4 @@
import json
from functools import partial
import copy
from unittest.mock import call, ANY
@@ -220,6 +221,30 @@ def test_anyone_can_see_inbox(
)
def test_view_inbox_updates(
logged_in_client,
service_one,
mocker,
mock_get_inbound_sms_with_no_messages,
):
service_one['permissions'] = ['inbound_sms']
mock_get_partials = mocker.patch(
'app.main.views.dashboard.get_inbox_partials',
return_value={'messages': 'foo'},
)
response = logged_in_client.get(url_for(
'main.inbox_updates', service_id=SERVICE_ONE_ID,
))
assert response.status_code == 200
assert json.loads(response.get_data(as_text=True)) == {'messages': 'foo'}
mock_get_partials.assert_called_once_with(SERVICE_ONE_ID)
def test_should_show_recent_templates_on_dashboard(
logged_in_client,
mocker,