mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-13 13:09:41 +02:00
updated portfolio members admin section and updated tests
This commit is contained in:
parent
7a235dcb97
commit
c6357435ed
2 changed files with 15 additions and 15 deletions
|
@ -4385,21 +4385,21 @@ class PortfolioAdmin(ListHeaderAdmin):
|
||||||
if admin_count > 0:
|
if admin_count > 0:
|
||||||
url = reverse("admin:registrar_userportfoliopermission_changelist") + f"?portfolio={obj.id}"
|
url = reverse("admin:registrar_userportfoliopermission_changelist") + f"?portfolio={obj.id}"
|
||||||
# Create a clickable link with the count
|
# Create a clickable link with the count
|
||||||
return format_html(f'<a href="{url}">{admin_count} administrators</a>')
|
return format_html(f'<a href="{url}">{admin_count} admins</a>')
|
||||||
return "No administrators found."
|
return "No admins found."
|
||||||
|
|
||||||
display_admins.short_description = "Administrators" # type: ignore
|
display_admins.short_description = "Admins" # type: ignore
|
||||||
|
|
||||||
def display_members(self, obj):
|
def display_members(self, obj):
|
||||||
"""Returns the number of members for this portfolio"""
|
"""Returns the number of basic members for this portfolio"""
|
||||||
member_count = len(self.get_user_portfolio_permission_non_admins(obj))
|
member_count = len(self.get_user_portfolio_permission_non_admins(obj))
|
||||||
if member_count > 0:
|
if member_count > 0:
|
||||||
url = reverse("admin:registrar_userportfoliopermission_changelist") + f"?portfolio={obj.id}"
|
url = reverse("admin:registrar_userportfoliopermission_changelist") + f"?portfolio={obj.id}"
|
||||||
# Create a clickable link with the count
|
# Create a clickable link with the count
|
||||||
return format_html(f'<a href="{url}">{member_count} members</a>')
|
return format_html(f'<a href="{url}">{member_count} basic members</a>')
|
||||||
return "No additional members found."
|
return "No basic members found."
|
||||||
|
|
||||||
display_members.short_description = "Members" # type: ignore
|
display_members.short_description = "Basic members" # type: ignore
|
||||||
|
|
||||||
# Creates select2 fields (with search bars)
|
# Creates select2 fields (with search bars)
|
||||||
autocomplete_fields = [
|
autocomplete_fields = [
|
||||||
|
|
|
@ -177,7 +177,7 @@ class TestDomainInvitationAdmin(WebTest):
|
||||||
|
|
||||||
# Test for a description snippet
|
# Test for a description snippet
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response, "Domain invitations contain all individuals who have been invited to manage a .gov domain."
|
response, "This table contains all individuals who have been invited to manage a .gov domain."
|
||||||
)
|
)
|
||||||
self.assertContains(response, "Show more")
|
self.assertContains(response, "Show more")
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ class TestDomainInvitationAdmin(WebTest):
|
||||||
# Test for a description snippet
|
# Test for a description snippet
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response,
|
response,
|
||||||
"If you add someone to a domain here, it will trigger emails to the invitee and all managers of the domain",
|
"If you invite someone to a domain here, it will trigger email notifications.",
|
||||||
)
|
)
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
|
@ -217,7 +217,7 @@ class TestDomainInvitationAdmin(WebTest):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Assert that the filters are added
|
# Assert that the filters are added
|
||||||
self.assertContains(response, "invited", count=5)
|
self.assertContains(response, "invited", count=4)
|
||||||
self.assertContains(response, "Invited", count=2)
|
self.assertContains(response, "Invited", count=2)
|
||||||
self.assertContains(response, "retrieved", count=2)
|
self.assertContains(response, "retrieved", count=2)
|
||||||
self.assertContains(response, "Retrieved", count=2)
|
self.assertContains(response, "Retrieved", count=2)
|
||||||
|
@ -1168,7 +1168,7 @@ class TestUserPortfolioPermissionAdmin(TestCase):
|
||||||
# Test for a description snippet
|
# Test for a description snippet
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response,
|
response,
|
||||||
"If you add someone to a portfolio here, it will not trigger an invitation email.",
|
"If you add someone to a portfolio here, it won't trigger any email notifications.",
|
||||||
)
|
)
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
|
@ -1183,7 +1183,7 @@ class TestUserPortfolioPermissionAdmin(TestCase):
|
||||||
response = self.client.get(delete_url)
|
response = self.client.get(delete_url)
|
||||||
|
|
||||||
# Check if the response contains the expected static message
|
# Check if the response contains the expected static message
|
||||||
expected_message = "If you remove someone from a portfolio here, it will not send any emails"
|
expected_message = "If you remove someone from a portfolio here, it won't trigger any email notifications."
|
||||||
self.assertIn(expected_message, response.content.decode("utf-8"))
|
self.assertIn(expected_message, response.content.decode("utf-8"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -1232,7 +1232,7 @@ class TestPortfolioInvitationAdmin(TestCase):
|
||||||
# Test for a description snippet
|
# Test for a description snippet
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response,
|
response,
|
||||||
"Portfolio invitations contain all individuals who have been invited to become members of an organization.",
|
"This table contains all individuals who have been invited to become members of a portfolio.",
|
||||||
)
|
)
|
||||||
self.assertContains(response, "Show more")
|
self.assertContains(response, "Show more")
|
||||||
|
|
||||||
|
@ -1256,7 +1256,7 @@ class TestPortfolioInvitationAdmin(TestCase):
|
||||||
# Test for a description snippet
|
# Test for a description snippet
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response,
|
response,
|
||||||
"If you add someone to a portfolio here, it will trigger an invitation email when you click",
|
"If you invite someone to a portfolio here, it will trigger email notifications.",
|
||||||
)
|
)
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
|
@ -2325,7 +2325,7 @@ class TestUserDomainRoleAdmin(WebTest):
|
||||||
# Test for a description snippet
|
# Test for a description snippet
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response,
|
response,
|
||||||
"If you add someone to a domain here, it will not trigger any emails.",
|
"If you add someone to a domain here, it won't trigger any email notifications.",
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_domain_sortable(self):
|
def test_domain_sortable(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue