mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 05:29:38 -04:00
Make the broadcast dashboard update via AJAX
Same technique as we use for other pages that update via AJAX. I’ve split the page up into separate chunks because the DiffDOM library we use finds it easier to work out what’s changed when there are fewer elements/a shallower tree.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import json
|
||||
|
||||
import pytest
|
||||
from flask import url_for
|
||||
from freezegun import freeze_time
|
||||
@@ -10,6 +12,7 @@ sample_uuid = sample_uuid()
|
||||
|
||||
@pytest.mark.parametrize('endpoint, extra_args', (
|
||||
('.broadcast_dashboard', {}),
|
||||
('.broadcast_dashboard_updates', {}),
|
||||
('.broadcast', {'template_id': sample_uuid}),
|
||||
('.preview_broadcast_areas', {'broadcast_message_id': sample_uuid}),
|
||||
('.choose_broadcast_library', {'broadcast_message_id': sample_uuid}),
|
||||
@@ -88,6 +91,28 @@ def test_broadcast_dashboard(
|
||||
]
|
||||
|
||||
|
||||
@freeze_time('2020-02-20 02:20')
|
||||
def test_broadcast_dashboard_json(
|
||||
logged_in_client,
|
||||
service_one,
|
||||
mock_get_broadcast_messages,
|
||||
):
|
||||
service_one['permissions'] += ['broadcast']
|
||||
response = logged_in_client.get(url_for(
|
||||
'.broadcast_dashboard_updates',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
))
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
json_response = json.loads(response.get_data(as_text=True))
|
||||
|
||||
assert json_response.keys() == {'live_broadcasts', 'previous_broadcasts'}
|
||||
|
||||
assert 'Live until tomorrow at 2:20am' in json_response['live_broadcasts']
|
||||
assert 'Finished yesterday at 8:20pm' in json_response['previous_broadcasts']
|
||||
|
||||
|
||||
def test_broadcast_page(
|
||||
client_request,
|
||||
service_one,
|
||||
|
||||
Reference in New Issue
Block a user