mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Fix empty table message
Bug was happening because: ```python bool(list()) >>> False ``` ```python bool((item for item in list())) >>> True ``` i.e. generator expressions cast to boolean are `True`, even if they’re empty – Python doesn’t evaluate them. This was causing the functional tests to fail because it was taking too long for any table rows to appear on the page.
This commit is contained in:
@@ -9,6 +9,7 @@ from bs4 import BeautifulSoup
|
||||
from app.main.views.jobs import get_time_left, get_status_filters
|
||||
from tests import notification_json
|
||||
from tests.conftest import SERVICE_ONE_ID
|
||||
from tests.app.test_utils import normalize_spaces
|
||||
from freezegun import freeze_time
|
||||
|
||||
|
||||
@@ -135,6 +136,23 @@ def test_can_show_notifications(
|
||||
assert json_content.keys() == {'counts', 'notifications'}
|
||||
|
||||
|
||||
def test_shows_message_when_no_notifications(
|
||||
client_request,
|
||||
mock_get_detailed_service,
|
||||
mock_get_notifications_with_no_notifications,
|
||||
):
|
||||
|
||||
page = client_request.get(
|
||||
'main.view_notifications',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
message_type='sms',
|
||||
)
|
||||
|
||||
assert normalize_spaces(page.select('tbody tr')[0].text) == (
|
||||
'No messages found'
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize((
|
||||
'initial_query_arguments,'
|
||||
'form_post_data,'
|
||||
|
||||
Reference in New Issue
Block a user