mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-29 08:50:01 +02:00
Merge pull request #2083 from cisagov/za/1998-add-table-descriptions
(on getgov-za) Ticket #1998: Add table descriptions
This commit is contained in:
commit
b94ae04363
20 changed files with 668 additions and 6 deletions
|
@ -394,3 +394,38 @@ function initializeWidgetOnList(list, parentId) {
|
|||
observer.observe(targetElement);
|
||||
}
|
||||
})();
|
||||
|
||||
/** An IIFE for toggling the overflow styles on django-admin__model-description (the show more / show less button) */
|
||||
(function () {
|
||||
function handleShowMoreButton(toggleButton, descriptionDiv){
|
||||
// Check the length of the text content in the description div
|
||||
if (descriptionDiv.textContent.length < 200) {
|
||||
// Hide the toggle button if text content is less than 200 characters
|
||||
// This is a little over 160 characters to give us some wiggle room if we
|
||||
// change the font size marginally.
|
||||
toggleButton.classList.add('display-none');
|
||||
} else {
|
||||
toggleButton.addEventListener('click', function() {
|
||||
toggleShowMoreButton(toggleButton, descriptionDiv, 'dja__model-description--no-overflow')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function toggleShowMoreButton(toggleButton, descriptionDiv, showMoreClassName){
|
||||
// Toggle the class on the description div
|
||||
descriptionDiv.classList.toggle(showMoreClassName);
|
||||
|
||||
// Change the button text based on the presence of the class
|
||||
if (descriptionDiv.classList.contains(showMoreClassName)) {
|
||||
toggleButton.textContent = 'Show less';
|
||||
} else {
|
||||
toggleButton.textContent = 'Show more';
|
||||
}
|
||||
}
|
||||
|
||||
let toggleButton = document.getElementById('dja-show-more-model-description');
|
||||
let descriptionDiv = document.querySelector('.dja__model-description');
|
||||
if (toggleButton && descriptionDiv) {
|
||||
handleShowMoreButton(toggleButton, descriptionDiv)
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -676,3 +676,35 @@ form .aligned p.help, form .aligned div.help {
|
|||
background: var(--primary);
|
||||
color: var(--header-link-color);
|
||||
}
|
||||
|
||||
div.dja__model-description{
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
|
||||
p, li {
|
||||
font-size: medium;
|
||||
color: var(--secondary);
|
||||
}
|
||||
|
||||
li {
|
||||
list-style-type: disc;
|
||||
font-family: Source Sans Pro Web,Helvetica Neue,Helvetica,Roboto,Arial,sans-serif;
|
||||
}
|
||||
|
||||
a, a:link, a:visited {
|
||||
font-size: medium;
|
||||
color: #005288 !important;
|
||||
}
|
||||
|
||||
&.dja__model-description--no-overflow {
|
||||
display: block;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.text-underline {
|
||||
text-decoration: underline !important;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
{% block content_title %}
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
{# Adds a model description #}
|
||||
{% include "admin/model_descriptions.html" %}
|
||||
|
||||
<h2>
|
||||
{{ cl.result_count }}
|
||||
{% if cl.get_ordering_field_columns %}
|
||||
|
|
37
src/registrar/templates/admin/model_descriptions.html
Normal file
37
src/registrar/templates/admin/model_descriptions.html
Normal file
|
@ -0,0 +1,37 @@
|
|||
|
||||
<div class="dja__model-description text-normal">
|
||||
{% if opts.model_name == 'domainrequest' %}
|
||||
{% include "django/admin/includes/descriptions/domain_request_description.html" %}
|
||||
{% elif opts.model_name == 'domaininformation' %}
|
||||
{% include "django/admin/includes/descriptions/domain_information_description.html" %}
|
||||
{% elif opts.model_name == 'domaininvitation' %}
|
||||
{% include "django/admin/includes/descriptions/domain_invitation_description.html" %}
|
||||
{% elif opts.model_name == 'contact' %}
|
||||
{% include "django/admin/includes/descriptions/contact_description.html" %}
|
||||
{% elif opts.model_name == 'logentry' %}
|
||||
{% include "django/admin/includes/descriptions/logentry_description.html" %}
|
||||
{% elif opts.model_name == 'domain'%}
|
||||
{% include "django/admin/includes/descriptions/domain_description.html" %}
|
||||
{% elif opts.model_name == 'draftdomain' %}
|
||||
{% include "django/admin/includes/descriptions/draft_domain_description.html" %}
|
||||
{% elif opts.model_name == 'host' %}
|
||||
{% include "django/admin/includes/descriptions/host_description.html" %}
|
||||
{% elif opts.model_name == 'publiccontact' %}
|
||||
{% include "django/admin/includes/descriptions/public_contact_description.html" %}
|
||||
{% elif opts.model_name == 'transitiondomain' %}
|
||||
{% include "django/admin/includes/descriptions/transition_domain_description.html" %}
|
||||
{% elif opts.model_name == 'userdomainrole' %}
|
||||
{% include "django/admin/includes/descriptions/user_domain_role_description.html" %}
|
||||
{% elif opts.model_name == 'usergroup' %}
|
||||
{% include "django/admin/includes/descriptions/user_group_description.html" %}
|
||||
{% elif opts.model_name == 'user' %}
|
||||
{% include "django/admin/includes/descriptions/user_description.html" %}
|
||||
{% elif opts.model_name == 'verifiedbystaff' %}
|
||||
{% include "django/admin/includes/descriptions/verified_by_staff_description.html" %}
|
||||
{% elif opts.model_name == 'website' %}
|
||||
{% include "django/admin/includes/descriptions/website_description.html" %}
|
||||
{% else %}
|
||||
<p>This table does not have a description yet.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<button id="dja-show-more-model-description" class="usa-button usa-button--unstyled text-no-underline margin-top-1" type="button">Show more</button>
|
|
@ -0,0 +1,10 @@
|
|||
<p>
|
||||
Contacts include anyone who has access to the registrar (known as “users”) and anyone listed in a domain request,
|
||||
including other employees and authorizing officials.
|
||||
Only contacts who have access to the registrar will have
|
||||
a corresponding record within the <a class="text-underline" href="{% url 'admin:registrar_user_changelist' %}">Users</a> table.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Updating someone’s contact information here will not affect that person’s Login.gov information.
|
||||
</p>
|
|
@ -0,0 +1,25 @@
|
|||
<p>
|
||||
This table contains all approved domains in the .gov registrar.
|
||||
In other words, with the exception of domains in the “Unknown”, ”On hold”, and “Deleted” states,
|
||||
this table matches the list of domains in the .gov zone file.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Individual domain pages allow you to view registry-related details and edit the associated domain information.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Other actions available on the domain page include the ability to:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Extend a domain’s expiration date</li>
|
||||
<li>Place a domain “On hold”</li>
|
||||
<li>Remove a domain from the registry</li>
|
||||
<li>View the domain from a domain manager’s perspective
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
To view a domain from a domain manager’s perspective, click the "Manage domain" button.
|
||||
That will allow you to make changes (e.g., update DNS settings, invite people to manage the domain)
|
||||
directly inside the registrar.
|
||||
</p>
|
|
@ -0,0 +1,19 @@
|
|||
<p>
|
||||
Domain information represents the basic metadata for an approved domain and the organization that manages it.
|
||||
It does not include any information specific to the registry (DNS name servers, security email).
|
||||
Registry-related information
|
||||
can be managed within the <a class="text-underline" href="{% url 'admin:registrar_domain_changelist' %}">Domains</a> table.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Updating values here will immediately update the corresponding values that users see in the registrar.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Domain information is similar to <a class="text-underline" href="{% url 'admin:registrar_domainrequest_changelist' %}">Domain requests</a>,
|
||||
and the fields are nearly identical,
|
||||
but edits made to one are not made to the other.
|
||||
Domain information exists so we don’t modify details of an approved request after adjudication
|
||||
(since a domain request should be maintained as-adjudicated for records retention purposes).
|
||||
Entries are created here upon approval of a domain request.
|
||||
</p>
|
|
@ -0,0 +1,16 @@
|
|||
<p>
|
||||
Domain invitations contain all individuals who have been invited to manage a .gov domain.
|
||||
Invitations are sent via email, and the recipient must log in to the registrar to officially
|
||||
accept and become a domain manager.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
An “invited” status indicates that the recipient has not logged in to the registrar since the invitation was sent.
|
||||
A “received” status indicates that the recipient has logged in.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If an invitation is created in this table, an email will not be sent.
|
||||
To have an email sent, go to the domain in <a class="text-underline" href="{% url 'admin:registrar_domain_changelist' %}">Domains</a>,
|
||||
click the “Manage domain” button, and add a domain manager.
|
||||
</p>
|
|
@ -0,0 +1,11 @@
|
|||
<p>
|
||||
This table contains all domain requests that have been started within the registrar and the status of those requests.
|
||||
Updating values here will immediately update the corresponding values that users see in the registrar.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Once a domain request has been adjudicated, the details of that request should not be modified.
|
||||
To update attributes (like an organization’s name) after a domain’s approval,
|
||||
go to <a class="text-underline" href="{% url 'admin:registrar_domain_changelist' %}">Domains</a>.
|
||||
Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request.
|
||||
</p>
|
|
@ -0,0 +1,10 @@
|
|||
<p>
|
||||
This table represents all “requested domains” that have been saved within a domain request form.
|
||||
If a registrant changes the requested domain in their form,
|
||||
the original name they listed and the new name will appear as separate records.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This table does not include “alternative domains,”
|
||||
which are housed in the <a class="text-underline" href="{% url 'admin:registrar_website_changelist' %}">Websites</a> table.
|
||||
</p>
|
|
@ -0,0 +1,11 @@
|
|||
<p>
|
||||
Entries in the Hosts table indicate the relationship between an approved domain and a name server address
|
||||
(and, if applicable, the IP address for a name server address).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In general, you should not modify these values here. They should be updated directly inside the registrar.
|
||||
To update a domain’s name servers and/or IP addresses,
|
||||
in the registrar, go to the domain in <a class="text-underline" href="{% url 'admin:registrar_domain_changelist' %}">Domains</a>,
|
||||
then click the "Manage domain" button.
|
||||
</p>
|
|
@ -0,0 +1,7 @@
|
|||
<p>
|
||||
Log entries represent instances where something was created, updated, or deleted within the registrar or /admin.
|
||||
The table on this page is useful for searching actions across all records.
|
||||
To understand what happened to an individual record (like a domain request),
|
||||
it’s better to go to that specific page
|
||||
(<a class="text-underline" href="{% url 'admin:registrar_domainrequest_changelist' %}">Domain requests</a>) and click on the “History” button.
|
||||
</p>
|
|
@ -0,0 +1,18 @@
|
|||
<p>
|
||||
Public contacts represent the three registry contact types (administrative, technical, and security)
|
||||
and their fields that are exposed in WHOIS data.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We don’t currently allow registrants to publish real contact information to WHOIS,
|
||||
but we must publish something to WHOIS. For each of the contact types, we use default values that are
|
||||
associated with the program instead of the real contact information,
|
||||
which we then redact in whole at the registry/WHOIS.
|
||||
We do allow registrants to set a security contact email address,
|
||||
which is published to WHOIS when a user sets one.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The public contacts in this table are a reflection of the data in the registry and should not be updated.
|
||||
This information is primarily used by developers for validation purposes.
|
||||
</p>
|
|
@ -0,0 +1,4 @@
|
|||
<p>
|
||||
This table represents the domains that were transitioned from the old registry in November 2023.
|
||||
This data has been preserved for historical reference and should not be updated.
|
||||
</p>
|
|
@ -0,0 +1,16 @@
|
|||
<p>
|
||||
A user is anyone who has access to the registrar. This includes request creators, domain managers, and CISA administrators.
|
||||
Within each user record, you can review that user’s permissions and user status.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If a user has a domain request in ineligible status, then their user status will be “restricted.”
|
||||
Users who are in restricted status cannot create/edit domain requests or approved domains,
|
||||
and their existing requests are locked. They will see a 403 error if they try to take action in the registrar.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Each user record displays the associated “contact” info for that user,
|
||||
which is the same info found in the <a class="text-underline" href="{% url 'admin:registrar_contact_changelist' %}">Contacts</a> table.
|
||||
Updating these details on the user record will also update the corresponding contact record for that user.
|
||||
</p>
|
|
@ -0,0 +1,10 @@
|
|||
<p>
|
||||
This table represents the managers who are assigned to each domain in the registrar.
|
||||
There are separate records for each domain/manager combination.
|
||||
Managers can update information related to a domain, such as DNS data and security contact.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The creator of an approved domain request automatically becomes a manager for that domain.
|
||||
Anyone who retrieves a domain invitation is also assigned the manager role.
|
||||
</p>
|
|
@ -0,0 +1,10 @@
|
|||
<p>
|
||||
Groups are a way to bundle admin permissions so they can be easily assigned to multiple users.
|
||||
Once a group is created, it can be assigned to people via the <a class="text-underline" href="{% url 'admin:registrar_user_changelist' %}">Users</a> table.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To maintain a single source of truth across all environments (stable, staging, etc.),
|
||||
the groups and permissions are set and updated through the codebase.
|
||||
<strong>Do not add, edit or delete user groups here.</strong>
|
||||
</p>
|
|
@ -0,0 +1,10 @@
|
|||
<p>
|
||||
This table contains users who have been allowed to bypass identity proofing through Login.gov after approval by a CISA representative.
|
||||
Bypassing identity proofing means they will not be asked to provide a form of ID, PII, and so on.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Additions to this table should be rare, and only after obtaining confirmation of their identity directly (or from a trusted person).
|
||||
Once a verified-by-staff user has been added as a domain manager, they can be removed from this list,
|
||||
(However, if they are removed as a domain manager for all domains and they attempt to sign in again, they will be identity proofed by Login.gov).
|
||||
</p>
|
|
@ -0,0 +1,8 @@
|
|||
<p>
|
||||
This table lists all the “current websites” and “alternative domains” that users have submitted in domain requests since January 2024.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This does not include any “requested domains” that have appeared within the <a class="text-underline" href="{% url 'admin:registrar_domainrequest_changelist' %}">Domain requests</a> table.
|
||||
Those names are managed in the <a class="text-underline" href="{% url 'admin:registrar_draftdomain_changelist' %}">Draft domains<a/> table.
|
||||
</p>
|
|
@ -21,6 +21,12 @@ from registrar.admin import (
|
|||
MyHostAdmin,
|
||||
UserDomainRoleAdmin,
|
||||
VerifiedByStaffAdmin,
|
||||
WebsiteAdmin,
|
||||
DraftDomainAdmin,
|
||||
FederalAgencyAdmin,
|
||||
PublicContactAdmin,
|
||||
TransitionDomainAdmin,
|
||||
UserGroupAdmin,
|
||||
)
|
||||
from registrar.models import (
|
||||
Domain,
|
||||
|
@ -33,6 +39,9 @@ from registrar.models import (
|
|||
PublicContact,
|
||||
Host,
|
||||
Website,
|
||||
FederalAgency,
|
||||
UserGroup,
|
||||
TransitionDomain,
|
||||
)
|
||||
from registrar.models.user_domain_role import UserDomainRole
|
||||
from registrar.models.verified_by_staff import VerifiedByStaff
|
||||
|
@ -95,6 +104,23 @@ class TestDomainAdmin(MockEppLib, WebTest):
|
|||
)
|
||||
super().setUp()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/domain/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(response, "This table contains all approved domains in the .gov registrar.")
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_contact_fields_on_domain_change_form_have_detail_table(self):
|
||||
"""Tests if the contact fields in the inlined Domain information have the detail table
|
||||
|
@ -511,7 +537,7 @@ class TestDomainAdmin(MockEppLib, WebTest):
|
|||
|
||||
# There are 4 template references to Federal (4) plus four references in the table
|
||||
# for our actual domain_request
|
||||
self.assertContains(response, "Federal", count=36)
|
||||
self.assertContains(response, "Federal", count=42)
|
||||
# This may be a bit more robust
|
||||
self.assertContains(response, '<td class="field-generic_org_type">Federal</td>', count=1)
|
||||
# Now let's make sure the long description does not exist
|
||||
|
@ -852,6 +878,23 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
)
|
||||
self.mock_client = MockSESClient()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/domainrequest/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(response, "This table contains all domain requests")
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_helper_text(self):
|
||||
"""
|
||||
|
@ -1267,7 +1310,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
response = self.client.get("/admin/registrar/domainrequest/?generic_org_type__exact=federal")
|
||||
# There are 2 template references to Federal (4) and two in the results data
|
||||
# of the request
|
||||
self.assertContains(response, "Federal", count=34)
|
||||
self.assertContains(response, "Federal", count=40)
|
||||
# This may be a bit more robust
|
||||
self.assertContains(response, '<td class="field-generic_org_type">Federal</td>', count=1)
|
||||
# Now let's make sure the long description does not exist
|
||||
|
@ -2492,7 +2535,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
self.mock_client.EMAILS_SENT.clear()
|
||||
|
||||
|
||||
class DomainInvitationAdminTest(TestCase):
|
||||
class TestDomainInvitationAdmin(TestCase):
|
||||
"""Tests for the DomainInvitation page"""
|
||||
|
||||
def setUp(self):
|
||||
|
@ -2508,6 +2551,25 @@ class DomainInvitationAdminTest(TestCase):
|
|||
User.objects.all().delete()
|
||||
Contact.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/domaininvitation/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(
|
||||
response, "Domain invitations contain all individuals who have been invited to manage a .gov domain."
|
||||
)
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
def test_get_filters(self):
|
||||
"""Ensures that our filters are displaying correctly"""
|
||||
with less_console_noise():
|
||||
|
@ -2522,7 +2584,7 @@ class DomainInvitationAdminTest(TestCase):
|
|||
)
|
||||
|
||||
# Assert that the filters are added
|
||||
self.assertContains(response, "invited", count=2)
|
||||
self.assertContains(response, "invited", count=4)
|
||||
self.assertContains(response, "Invited", count=2)
|
||||
self.assertContains(response, "retrieved", count=2)
|
||||
self.assertContains(response, "Retrieved", count=2)
|
||||
|
@ -2557,6 +2619,23 @@ class TestHostAdmin(TestCase):
|
|||
Host.objects.all().delete()
|
||||
Domain.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/host/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(response, "Entries in the Hosts table indicate the relationship between an approved domain")
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_helper_text(self):
|
||||
"""
|
||||
|
@ -2635,6 +2714,23 @@ class TestDomainInformationAdmin(TestCase):
|
|||
Contact.objects.all().delete()
|
||||
User.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/domaininformation/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(response, "Domain information represents the basic metadata")
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_helper_text(self):
|
||||
"""
|
||||
|
@ -2878,7 +2974,7 @@ class TestDomainInformationAdmin(TestCase):
|
|||
self.test_helper.assert_table_sorted("-4", ("-submitter__first_name", "-submitter__last_name"))
|
||||
|
||||
|
||||
class UserDomainRoleAdminTest(TestCase):
|
||||
class TestUserDomainRoleAdmin(TestCase):
|
||||
def setUp(self):
|
||||
"""Setup environment for a mock admin user"""
|
||||
self.site = AdminSite()
|
||||
|
@ -2900,6 +2996,25 @@ class UserDomainRoleAdminTest(TestCase):
|
|||
Domain.objects.all().delete()
|
||||
UserDomainRole.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/userdomainrole/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(
|
||||
response, "This table represents the managers who are assigned to each domain in the registrar"
|
||||
)
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
def test_domain_sortable(self):
|
||||
"""Tests if the UserDomainrole sorts by domain correctly"""
|
||||
with less_console_noise():
|
||||
|
@ -3096,6 +3211,23 @@ class TestMyUserAdmin(TestCase):
|
|||
super().tearDown()
|
||||
User.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/user/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(response, "A user is anyone who has access to the registrar.")
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_helper_text(self):
|
||||
"""
|
||||
|
@ -3530,7 +3662,7 @@ class DomainSessionVariableTest(TestCase):
|
|||
)
|
||||
|
||||
|
||||
class ContactAdminTest(TestCase):
|
||||
class TestContactAdmin(TestCase):
|
||||
def setUp(self):
|
||||
self.site = AdminSite()
|
||||
self.factory = RequestFactory()
|
||||
|
@ -3539,6 +3671,23 @@ class ContactAdminTest(TestCase):
|
|||
self.superuser = create_superuser()
|
||||
self.staffuser = create_user()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/contact/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(response, "Contacts include anyone who has access to the registrar (known as “users”)")
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
def test_readonly_when_restricted_staffuser(self):
|
||||
with less_console_noise():
|
||||
request = self.factory.get("/")
|
||||
|
@ -3657,6 +3806,25 @@ class TestVerifiedByStaffAdmin(TestCase):
|
|||
VerifiedByStaff.objects.all().delete()
|
||||
User.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/verifiedbystaff/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(
|
||||
response, "This table contains users who have been allowed to bypass " "identity proofing through Login.gov"
|
||||
)
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_helper_text(self):
|
||||
"""
|
||||
|
@ -3699,3 +3867,204 @@ class TestVerifiedByStaffAdmin(TestCase):
|
|||
|
||||
# Check that the user field is set to the request.user
|
||||
self.assertEqual(vip_instance.requestor, self.superuser)
|
||||
|
||||
|
||||
class TestWebsiteAdmin(TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.site = AdminSite()
|
||||
self.superuser = create_superuser()
|
||||
self.admin = WebsiteAdmin(model=Website, admin_site=self.site)
|
||||
self.factory = RequestFactory()
|
||||
self.client = Client(HTTP_HOST="localhost:8080")
|
||||
self.test_helper = GenericTestHelper(admin=self.admin)
|
||||
|
||||
def tearDown(self):
|
||||
super().tearDown()
|
||||
Website.objects.all().delete()
|
||||
User.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/website/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(response, "This table lists all the “current websites” and “alternative domains”")
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
|
||||
class TestDraftDomain(TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.site = AdminSite()
|
||||
self.superuser = create_superuser()
|
||||
self.admin = DraftDomainAdmin(model=DraftDomain, admin_site=self.site)
|
||||
self.factory = RequestFactory()
|
||||
self.client = Client(HTTP_HOST="localhost:8080")
|
||||
self.test_helper = GenericTestHelper(admin=self.admin)
|
||||
|
||||
def tearDown(self):
|
||||
super().tearDown()
|
||||
DraftDomain.objects.all().delete()
|
||||
User.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/draftdomain/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(
|
||||
response, "This table represents all “requested domains” that have been saved within a domain"
|
||||
)
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
|
||||
class TestFederalAgency(TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.site = AdminSite()
|
||||
self.superuser = create_superuser()
|
||||
self.admin = FederalAgencyAdmin(model=FederalAgency, admin_site=self.site)
|
||||
self.factory = RequestFactory()
|
||||
self.client = Client(HTTP_HOST="localhost:8080")
|
||||
self.test_helper = GenericTestHelper(admin=self.admin)
|
||||
|
||||
def tearDown(self):
|
||||
super().tearDown()
|
||||
FederalAgency.objects.all().delete()
|
||||
User.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/federalagency/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(response, "This table does not have a description yet.")
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
|
||||
class TestPublicContact(TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.site = AdminSite()
|
||||
self.superuser = create_superuser()
|
||||
self.admin = PublicContactAdmin(model=PublicContact, admin_site=self.site)
|
||||
self.factory = RequestFactory()
|
||||
self.client = Client(HTTP_HOST="localhost:8080")
|
||||
self.test_helper = GenericTestHelper(admin=self.admin)
|
||||
|
||||
def tearDown(self):
|
||||
super().tearDown()
|
||||
PublicContact.objects.all().delete()
|
||||
User.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/publiccontact/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(response, "Public contacts represent the three registry contact types")
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
|
||||
class TestTransitionDomain(TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.site = AdminSite()
|
||||
self.superuser = create_superuser()
|
||||
self.admin = TransitionDomainAdmin(model=TransitionDomain, admin_site=self.site)
|
||||
self.factory = RequestFactory()
|
||||
self.client = Client(HTTP_HOST="localhost:8080")
|
||||
self.test_helper = GenericTestHelper(admin=self.admin)
|
||||
|
||||
def tearDown(self):
|
||||
super().tearDown()
|
||||
PublicContact.objects.all().delete()
|
||||
User.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/transitiondomain/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(response, "This table represents the domains that were transitioned from the old registry")
|
||||
self.assertContains(response, "Show more")
|
||||
|
||||
|
||||
class TestUserGroup(TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.site = AdminSite()
|
||||
self.superuser = create_superuser()
|
||||
self.admin = UserGroupAdmin(model=UserGroup, admin_site=self.site)
|
||||
self.factory = RequestFactory()
|
||||
self.client = Client(HTTP_HOST="localhost:8080")
|
||||
self.test_helper = GenericTestHelper(admin=self.admin)
|
||||
|
||||
def tearDown(self):
|
||||
super().tearDown()
|
||||
User.objects.all().delete()
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_has_model_description(self):
|
||||
"""Tests if this model has a model description on the table view"""
|
||||
p = "adminpass"
|
||||
self.client.login(username="superuser", password=p)
|
||||
response = self.client.get(
|
||||
"/admin/registrar/usergroup/",
|
||||
follow=True,
|
||||
)
|
||||
|
||||
# Make sure that the page is loaded correctly
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Test for a description snippet
|
||||
self.assertContains(
|
||||
response, "Groups are a way to bundle admin permissions so they can be easily assigned to multiple users."
|
||||
)
|
||||
self.assertContains(response, "Show more")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue