mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
merge from main
This commit is contained in:
@@ -1517,6 +1517,7 @@ def test_breadcrumb_shows_if_service_is_suspended(
|
||||
],
|
||||
)
|
||||
def test_service_dashboard_shows_usage(
|
||||
mocker,
|
||||
client_request,
|
||||
service_one,
|
||||
mock_get_service_templates,
|
||||
@@ -1526,18 +1527,22 @@ def test_service_dashboard_shows_usage(
|
||||
mock_get_free_sms_fragment_limit,
|
||||
permissions,
|
||||
):
|
||||
mocker.patch(
|
||||
"app.service_api_client.get_global_notification_count",
|
||||
return_value={
|
||||
"count": 500,
|
||||
},
|
||||
)
|
||||
|
||||
service_one["permissions"] = permissions
|
||||
page = client_request.get("main.service_dashboard", service_id=SERVICE_ONE_ID)
|
||||
|
||||
assert normalize_spaces(page.select_one("[data-key=usage]").text) == (
|
||||
"Daily Usage Remaining "
|
||||
"40,000 "
|
||||
"$29.85 "
|
||||
"spent on text messages"
|
||||
# Disabled for pilot
|
||||
# '0 '
|
||||
# 'email disabled during SMS pilot'
|
||||
)
|
||||
table_rows = page.find_all("tbody")[0].find_all("tr")
|
||||
|
||||
assert len(table_rows) == 1
|
||||
|
||||
assert "500" in table_rows[0].find_all("td")[0].text
|
||||
assert "9500" in table_rows[0].find_all("td")[1].text
|
||||
|
||||
|
||||
def test_service_dashboard_shows_free_allowance(
|
||||
@@ -1566,4 +1571,4 @@ def test_service_dashboard_shows_free_allowance(
|
||||
|
||||
usage_text = normalize_spaces(page.select_one("[data-key=usage]").text)
|
||||
assert "spent on text messages" not in usage_text
|
||||
assert "Daily Usage Remaining -209,000 249,000" in usage_text
|
||||
assert "Daily Usage Remaining 1,000 249,000" in usage_text
|
||||
|
||||
@@ -39,28 +39,12 @@ from tests.conftest import (
|
||||
),
|
||||
(
|
||||
create_active_user_empty_permissions(),
|
||||
(
|
||||
"Test User With Empty Permissions (you) "
|
||||
"Permissions "
|
||||
"Cannot See dashboard "
|
||||
"Cannot Send messages "
|
||||
"Cannot Add and edit templates "
|
||||
"Cannot Manage settings, team and usage "
|
||||
"Cannot Manage API integration"
|
||||
),
|
||||
("Test User With Empty Permissions (you) " "Permissions"),
|
||||
False,
|
||||
),
|
||||
(
|
||||
create_active_user_view_permissions(),
|
||||
(
|
||||
"Test User With Permissions (you) "
|
||||
"Permissions "
|
||||
"Can See dashboard "
|
||||
"Cannot Send messages "
|
||||
"Cannot Add and edit templates "
|
||||
"Cannot Manage settings, team and usage "
|
||||
"Cannot Manage API integration"
|
||||
),
|
||||
("Test User With Permissions (you) " "Permissions " "Can See dashboard"),
|
||||
False,
|
||||
),
|
||||
(
|
||||
@@ -69,10 +53,7 @@ from tests.conftest import (
|
||||
"Test User With Permissions (you) "
|
||||
"Permissions "
|
||||
"Can See dashboard "
|
||||
"Cannot Send messages "
|
||||
"Can Add and edit templates "
|
||||
"Cannot Manage settings, team and usage "
|
||||
"Cannot Manage API integration"
|
||||
"Can Add and edit templates"
|
||||
),
|
||||
False,
|
||||
),
|
||||
@@ -112,15 +93,7 @@ def test_should_show_overview_page(
|
||||
normalize_spaces(page.select(".user-list-item")[0].text) == expected_self_text
|
||||
)
|
||||
|
||||
expected = (
|
||||
"ZZZZZZZZ zzzzzzz@example.gsa.gov "
|
||||
"Permissions "
|
||||
"Can See dashboard "
|
||||
"Cannot Send messages "
|
||||
"Cannot Add and edit templates "
|
||||
"Cannot Manage settings, team and usage "
|
||||
"Cannot Manage API integration"
|
||||
)
|
||||
expected = "ZZZZZZZZ zzzzzzz@example.gsa.gov " "Permissions " "Can See dashboard"
|
||||
|
||||
if add_details is True:
|
||||
expected = f"{expected} Change details for ZZZZZZZZ zzzzzzz@example.gsa.gov"
|
||||
@@ -259,23 +232,11 @@ def test_should_show_caseworker_on_overview_page(
|
||||
|
||||
assert normalize_spaces(page.select_one("h1").text) == "Team members"
|
||||
assert normalize_spaces(page.select(".user-list-item")[0].text) == (
|
||||
"Test User With Permissions (you) "
|
||||
"Permissions "
|
||||
"Can See dashboard "
|
||||
"Cannot Send messages "
|
||||
"Cannot Add and edit templates "
|
||||
"Cannot Manage settings, team and usage "
|
||||
"Cannot Manage API integration"
|
||||
"Test User With Permissions (you) " "Permissions " "Can See dashboard"
|
||||
)
|
||||
# [1:5] are invited users
|
||||
assert normalize_spaces(page.select(".user-list-item")[6].text) == (
|
||||
"Test User zzzzzzz@example.gsa.gov "
|
||||
"Permissions "
|
||||
"Cannot See dashboard "
|
||||
"Can Send messages "
|
||||
"Cannot Add and edit templates "
|
||||
"Cannot Manage settings, team and usage "
|
||||
"Cannot Manage API integration"
|
||||
"Test User zzzzzzz@example.gsa.gov " "Permissions " "Can Send messages"
|
||||
)
|
||||
|
||||
|
||||
@@ -1240,7 +1201,6 @@ def test_cancel_invited_user_doesnt_work_if_user_not_invited_to_this_service(
|
||||
"Permissions "
|
||||
"Can See dashboard "
|
||||
"Can Send messages "
|
||||
"Cannot Add and edit templates "
|
||||
"Can Manage settings, team and usage "
|
||||
"Can Manage API integration "
|
||||
"Cancel invitation for invited_user@test.gsa.gov"
|
||||
@@ -1250,13 +1210,8 @@ def test_cancel_invited_user_doesnt_work_if_user_not_invited_to_this_service(
|
||||
"cancelled",
|
||||
(
|
||||
"invited_user@test.gsa.gov (cancelled invite) "
|
||||
"Permissions "
|
||||
"Permissions"
|
||||
# all permissions are greyed out
|
||||
"Cannot See dashboard "
|
||||
"Cannot Send messages "
|
||||
"Cannot Add and edit templates "
|
||||
"Cannot Manage settings, team and usage "
|
||||
"Cannot Manage API integration"
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -4,7 +4,7 @@ import pytest
|
||||
from flask import url_for
|
||||
|
||||
from app.models.user import User
|
||||
from tests.conftest import SERVICE_ONE_ID, create_platform_admin_user, normalize_spaces
|
||||
from tests.conftest import SERVICE_ONE_ID, normalize_spaces
|
||||
|
||||
|
||||
def test_render_sign_in_template_for_new_user(client_request):
|
||||
@@ -72,19 +72,6 @@ def test_doesnt_redirect_to_sign_in_if_no_session_info(
|
||||
with client_request.session_transaction() as session:
|
||||
session["current_session_id"] = None
|
||||
|
||||
# This returns a 403 now
|
||||
with pytest.raises(AssertionError):
|
||||
client_request.get("main.add_service")
|
||||
|
||||
|
||||
def test_doesnt_redirect_to_sign_in_if_no_session_info_platform_admin(
|
||||
client_request,
|
||||
mock_get_organization_by_domain,
|
||||
):
|
||||
platform_admin = create_platform_admin_user()
|
||||
client_request.login(platform_admin)
|
||||
platform_admin["current_session_id"] = str(uuid.UUID(int=1))
|
||||
|
||||
with client_request.session_transaction() as session:
|
||||
session["current_session_id"] = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user