From d32d94c5489caac80474ad9b00eb46d76adf6d91 Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Wed, 24 Apr 2024 14:06:13 -0600 Subject: [PATCH 01/76] Display --- src/registrar/assets/sass/_theme/_admin.scss | 8 +++++++ .../templates/admin/change_list.html | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/registrar/assets/sass/_theme/_admin.scss b/src/registrar/assets/sass/_theme/_admin.scss index f5717d067..ad627e106 100644 --- a/src/registrar/assets/sass/_theme/_admin.scss +++ b/src/registrar/assets/sass/_theme/_admin.scss @@ -617,3 +617,11 @@ address.dja-address-contact-list { .usa-button__small-text { font-size: small; } + +p.django-admin__model-description{ + color: var(--primary); + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + overflow: hidden; +} diff --git a/src/registrar/templates/admin/change_list.html b/src/registrar/templates/admin/change_list.html index 05c2d4e64..78fa69fb5 100644 --- a/src/registrar/templates/admin/change_list.html +++ b/src/registrar/templates/admin/change_list.html @@ -2,6 +2,28 @@ {% block content_title %}
+ 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. + 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 Domains. + Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request. +
+ {% elif opts.model_name == 'contact' %} +
+ 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 Users table.
+
+ Updating someone’s contact information here will not affect that person’s Login.gov information.
+
- 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. - 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 Domains. - Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request. -
- {% elif opts.model_name == 'contact' %} -
- 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 Users table.
-
- Updating someone’s contact information here will not affect that person’s Login.gov information.
-
+ {{ model_description|safe }} +
- {{ model_description|safe }}
+ {% if opts.model_name == 'domainrequest' %}
+ 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.
+
+ 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 Domains.
+ Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request.
+ {% elif opts.model_name == 'domaininformation' %}
+ 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 Domains table.
+
+
+ {# Acts as a
#}
+
- {% if opts.model_name == 'domainrequest' %}
- 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.
-
- 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 Domains.
- Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request.
- {% elif opts.model_name == 'domaininformation' %}
- 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 Domains table.
-
-
- {# Acts as a
#}
-
+ 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. +
+ ++ 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 Domains. + Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request. +
+ {% elif opts.model_name == 'domaininformation' %} ++ 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 Domains table. +
+ ++ Updating values here will immediately update the corresponding values that users see in the registrar. +
+ ++ Domain information is similar to Domain requests, + 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. +
+ {% elif opts.model_name == 'contact' %} ++ 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 Users table. + Updating someone’s contact information here will not affect that person’s Login.gov information. +
+ {% elif opts.model_name == 'auditlog' %} ++ 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 + (Domain requests) and click on the “History” button. +
+ {% elif opts.model_name == 'domain'%} ++ 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. +
+ ++ Individual domain pages allow you to view registry-related details and edit the associated domain information. +
+ ++ Other actions available on the domain page include the ability to: +
++ 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. +
+ {% elif opts.model_name == 'draftdomain' %} ++ 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. +
+ ++ This table does not include “alternative domains,” + which are housed in the Websites table. +
+ {% elif opts.model_name == 'host' %} ++ 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). +
+ ++ 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 Domains, + then click the "Manage domain" button. +
+ {% elif opts.model_name == 'publiccontact' %} ++ Public contacts represent the three registry contact types (administrative, technical, and security) + and their fields that are exposed in WHOIS data. +
+ ++ 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. +
+ ++ 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. +
+ {% elif opts.model_name == 'transitiondomain' %} ++ 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. +
+ {% elif opts.model_name == 'userdomainrole' %} ++ 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. +
+ ++ 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. +
+ {% elif opts.model_name == 'usergroup' %} ++ 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 Users table. +
+ ++ To maintain a single source of truth across all environments (stable, staging, etc.), + the groups and permissions are set and updated through the codebase. + Do not add, edit or delete user groups here. +
+ {% elif opts.model_name == 'user' %} ++ 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. +
+ ++ 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. +
+ ++ Each user record displays the associated “contact” info for that user, + which is the same info found in the Contacts table. + Updating these details on the user record will also update the corresponding contact record for that user. +
+ {% elif opts.model_name == 'verifiedbystaff' %} ++ 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. +
+ ++ 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). +
+ {% elif opts.model_name == 'websites' %} ++ This section lists all the “current websites” and “alternative domains” that users have submitted in domain requests since January 2024. +
+ ++ This does not include any “requested domains” that have appeared within the Domain requests table. + Those names are managed in the Draft domains table. +
+ {% endif %} +- 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. -
+ ++ 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. +
-- 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 Domains. - Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request. -
- {% elif opts.model_name == 'domaininformation' %} -- 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 Domains table. -
++ 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 Domains. + Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request. +
+ {% elif opts.model_name == 'domaininformation' %} ++ 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 Domains table. +
-- Updating values here will immediately update the corresponding values that users see in the registrar. -
++ Updating values here will immediately update the corresponding values that users see in the registrar. +
-- Domain information is similar to Domain requests, - 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. -
- {% elif opts.model_name == 'contact' %} -- 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 Users table. - Updating someone’s contact information here will not affect that person’s Login.gov information. -
- {% elif opts.model_name == 'auditlog' %} -- 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 - (Domain requests) and click on the “History” button. -
- {% elif opts.model_name == 'domain'%} -- 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. -
++ Domain information is similar to Domain requests, + 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. +
+ {% elif opts.model_name == 'contact' %} ++ 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 Users table. + Updating someone’s contact information here will not affect that person’s Login.gov information. +
+ {% elif opts.model_name == 'auditlog' %} ++ 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 + (Domain requests) and click on the “History” button. +
+ {% elif opts.model_name == 'domain'%} ++ 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. +
-- Individual domain pages allow you to view registry-related details and edit the associated domain information. -
++ Individual domain pages allow you to view registry-related details and edit the associated domain information. +
-- Other actions available on the domain page include the ability to: -
-+ Other actions available on the domain page include the ability to: +
+- 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. -
- {% elif opts.model_name == 'draftdomain' %} -- 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. -
- -- This table does not include “alternative domains,” - which are housed in the Websites table. -
- {% elif opts.model_name == 'host' %} -- 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). -
++ 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. +
+ {% elif opts.model_name == 'draftdomain' %} ++ 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. +
+ ++ This table does not include “alternative domains,” + which are housed in the Websites table. +
+ {% elif opts.model_name == 'host' %} ++ 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). +
-- 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 Domains, - then click the "Manage domain" button. -
- {% elif opts.model_name == 'publiccontact' %} -- Public contacts represent the three registry contact types (administrative, technical, and security) - and their fields that are exposed in WHOIS data. -
++ 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 Domains, + then click the "Manage domain" button. +
+ {% elif opts.model_name == 'publiccontact' %} ++ Public contacts represent the three registry contact types (administrative, technical, and security) + and their fields that are exposed in WHOIS data. +
-- 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. -
++ 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. +
-- 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. -
- {% elif opts.model_name == 'transitiondomain' %} -- 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. -
- {% elif opts.model_name == 'userdomainrole' %} -- 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. -
++ 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. +
+ {% elif opts.model_name == 'transitiondomain' %} ++ 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. +
+ {% elif opts.model_name == 'userdomainrole' %} ++ 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. +
-- 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. -
- {% elif opts.model_name == 'usergroup' %} -- 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 Users table. -
++ 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. +
+ {% elif opts.model_name == 'usergroup' %} ++ 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 Users table. +
-- To maintain a single source of truth across all environments (stable, staging, etc.), - the groups and permissions are set and updated through the codebase. - Do not add, edit or delete user groups here. -
- {% elif opts.model_name == 'user' %} -- 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. -
++ To maintain a single source of truth across all environments (stable, staging, etc.), + the groups and permissions are set and updated through the codebase. + Do not add, edit or delete user groups here. +
+ {% elif opts.model_name == 'user' %} ++ 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. +
-- 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. -
++ 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. +
-- Each user record displays the associated “contact” info for that user, - which is the same info found in the Contacts table. - Updating these details on the user record will also update the corresponding contact record for that user. -
- {% elif opts.model_name == 'verifiedbystaff' %} -- 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. -
++ Each user record displays the associated “contact” info for that user, + which is the same info found in the Contacts table. + Updating these details on the user record will also update the corresponding contact record for that user. +
+ {% elif opts.model_name == 'verifiedbystaff' %} ++ 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. +
-- 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). -
- {% elif opts.model_name == 'websites' %} -- This section lists all the “current websites” and “alternative domains” that users have submitted in domain requests since January 2024. -
++ 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). +
+ {% elif opts.model_name == 'website' %} ++ This table lists all the “current websites” and “alternative domains” that users have submitted in domain requests since January 2024. +
-- This does not include any “requested domains” that have appeared within the Domain requests table. - Those names are managed in the Draft domains table. -
- {% endif %} -+ This does not include any “requested domains” that have appeared within the Domain requests table. + Those names are managed in the Draft domains table. +
+ {% else %} +This table does not have a description yet.
+ {% endif %} +This table does not have a description yet.
{% endif %} - + \ No newline at end of file From 0bcc9ca43ac0153b06835bd98ebd83ccaa683b89 Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:36:42 -0600 Subject: [PATCH 07/76] Add styling + javascript --- src/registrar/assets/js/get-gov-admin.js | 24 +++++++++++++++ src/registrar/assets/sass/_theme/_admin.scss | 29 ++++++++++++------- .../templates/admin/model_descriptions.html | 4 +-- 3 files changed, 45 insertions(+), 12 deletions(-) diff --git a/src/registrar/assets/js/get-gov-admin.js b/src/registrar/assets/js/get-gov-admin.js index 2909a48be..3a5c9c184 100644 --- a/src/registrar/assets/js/get-gov-admin.js +++ b/src/registrar/assets/js/get-gov-admin.js @@ -555,3 +555,27 @@ function enableRelatedWidgetButtons(changeLink, deleteLink, viewLink, elementPk, observer.observe(targetElement); } })(); + +/** An IIFE for toggling the overflow styles on django-admin__model-description (the show more / show less button) */ +(function () { + let toggleButton = document.getElementById('dja-show-more-model-description'); + let descriptionDiv = document.querySelector('.dja__model-description'); + + if (toggleButton && descriptionDiv) { + toggleButton.addEventListener('click', function() { + // Toggle the class on the description div + descriptionDiv.classList.toggle('dja__model-description--no-overflow'); + + // Change the button text based on the presence of the class + if (descriptionDiv.classList.contains('dja__model-description--no-overflow')) { + toggleButton.textContent = 'Show less'; + + // Move the div to where it was when the page first loaded + descriptionDiv.appendChild(toggleButton); + } else { + toggleButton.textContent = 'Show more'; + descriptionDiv.insertAdjacentElement('afterend', toggleButton); + } + }); + } +})(); \ No newline at end of file diff --git a/src/registrar/assets/sass/_theme/_admin.scss b/src/registrar/assets/sass/_theme/_admin.scss index 88c77cd09..898d3d538 100644 --- a/src/registrar/assets/sass/_theme/_admin.scss +++ b/src/registrar/assets/sass/_theme/_admin.scss @@ -618,7 +618,12 @@ address.dja-address-contact-list { font-size: small; } -div.django-admin__model-description{ +div.dja__model-description{ + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; + p, li { color: var(--primary); font-size: medium; @@ -629,13 +634,17 @@ div.django-admin__model-description{ list-style-type: disc; } - button { - margin-top: 25px !important; - height: 10px !important; - } - - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; +} + +.dja__model-description + button { + margin-top: 25px !important; + height: 10px !important; +} + +div.dja__model-description.dja__model-description--no-overflow { + display: block; + overflow: unset; + button { + margin-top: unset; + } } diff --git a/src/registrar/templates/admin/model_descriptions.html b/src/registrar/templates/admin/model_descriptions.html index d04fe9bbe..425c0e677 100644 --- a/src/registrar/templates/admin/model_descriptions.html +++ b/src/registrar/templates/admin/model_descriptions.html @@ -1,5 +1,5 @@ -This table contains all domain requests that have been started within the registrar and the status of those requests. @@ -184,5 +184,5 @@
This table does not have a description yet.
{% endif %}- 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. -
-- 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 Domains. - Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request. -
- {% elif opts.model_name == 'domaininformation' %} -- 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 Domains table. -
++ 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. +
-- Updating values here will immediately update the corresponding values that users see in the registrar. -
++ 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 Domains. + Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request. +
+ {% elif opts.model_name == 'domaininformation' %} ++ 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 Domains table. +
-- Domain information is similar to Domain requests, - 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. -
- {% elif opts.model_name == 'contact' %} -- 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 Users table. - Updating someone’s contact information here will not affect that person’s Login.gov information. -
- {% elif opts.model_name == 'auditlog' %} -- 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 - (Domain requests) and click on the “History” button. -
- {% elif opts.model_name == 'domain'%} -- 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. -
++ Updating values here will immediately update the corresponding values that users see in the registrar. +
-- Individual domain pages allow you to view registry-related details and edit the associated domain information. -
++ Domain information is similar to Domain requests, + 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. +
+ {% elif opts.model_name == 'contact' %} ++ 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 Users table. + Updating someone’s contact information here will not affect that person’s Login.gov information. +
+ {% elif opts.model_name == 'auditlog' %} ++ 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 + (Domain requests) and click on the “History” button. +
+ {% elif opts.model_name == 'domain'%} ++ 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. +
-- Other actions available on the domain page include the ability to: -
-+ Individual domain pages allow you to view registry-related details and edit the associated domain information. +
-- 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. -
- {% elif opts.model_name == 'draftdomain' %} -- 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. -
- -- This table does not include “alternative domains,” - which are housed in the Websites table. -
- {% elif opts.model_name == 'host' %} -- 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). -
++ Other actions available on the domain page include the ability to: +
+- 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 Domains, - then click the "Manage domain" button. -
- {% elif opts.model_name == 'publiccontact' %} -- Public contacts represent the three registry contact types (administrative, technical, and security) - and their fields that are exposed in WHOIS data. -
++ 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. +
+ {% elif opts.model_name == 'draftdomain' %} ++ 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. +
+ ++ This table does not include “alternative domains,” + which are housed in the Websites table. +
+ {% elif opts.model_name == 'host' %} ++ 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). +
-- 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. -
++ 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 Domains, + then click the "Manage domain" button. +
+ {% elif opts.model_name == 'publiccontact' %} ++ Public contacts represent the three registry contact types (administrative, technical, and security) + and their fields that are exposed in WHOIS data. +
-- 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. -
- {% elif opts.model_name == 'transitiondomain' %} -- 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. -
- {% elif opts.model_name == 'userdomainrole' %} -- 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. -
++ 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. +
-- 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. -
- {% elif opts.model_name == 'usergroup' %} -- 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 Users table. -
++ 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. +
+ {% elif opts.model_name == 'transitiondomain' %} ++ 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. +
+ {% elif opts.model_name == 'userdomainrole' %} ++ 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. +
-- To maintain a single source of truth across all environments (stable, staging, etc.), - the groups and permissions are set and updated through the codebase. - Do not add, edit or delete user groups here. -
- {% elif opts.model_name == 'user' %} -- 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. -
++ 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. +
+ {% elif opts.model_name == 'usergroup' %} ++ 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 Users table. +
-- 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. -
++ To maintain a single source of truth across all environments (stable, staging, etc.), + the groups and permissions are set and updated through the codebase. + Do not add, edit or delete user groups here. +
+ {% elif opts.model_name == 'user' %} ++ 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. +
-- Each user record displays the associated “contact” info for that user, - which is the same info found in the Contacts table. - Updating these details on the user record will also update the corresponding contact record for that user. -
- {% elif opts.model_name == 'verifiedbystaff' %} -- 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. -
++ 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. +
-- 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). -
- {% elif opts.model_name == 'website' %} -- This table lists all the “current websites” and “alternative domains” that users have submitted in domain requests since January 2024. -
++ Each user record displays the associated “contact” info for that user, + which is the same info found in the Contacts table. + Updating these details on the user record will also update the corresponding contact record for that user. +
+ {% elif opts.model_name == 'verifiedbystaff' %} ++ 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. +
-- This does not include any “requested domains” that have appeared within the Domain requests table. - Those names are managed in the Draft domains table. -
- {% else %} -This table does not have a description yet.
- {% endif %} -+ 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). +
+ {% elif opts.model_name == 'website' %} ++ This table lists all the “current websites” and “alternative domains” that users have submitted in domain requests since January 2024. +
+ ++ This does not include any “requested domains” that have appeared within the Domain requests table. + Those names are managed in the Draft domains table. +
+ {% else %} +This table does not have a description yet.
+ {% endif %} +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 Domains. + go to Domains. Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request.
{% elif opts.model_name == 'domaininformation' %} @@ -140,7 +140,7 @@To maintain a single source of truth across all environments (stable, staging, etc.), - the groups and permissions are set and updated through the codebase. + the groups and permissions are set and updated through the codebase. Do not add, edit or delete user groups here.
{% elif opts.model_name == 'user' %} From ac923701a02e90d76d7caebc4133beb6a45626a4 Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Fri, 26 Apr 2024 10:14:41 -0600 Subject: [PATCH 12/76] Unit tests part 1 --- src/registrar/tests/test_admin.py | 176 +++++++++++++++++++++++++++++- 1 file changed, 173 insertions(+), 3 deletions(-) diff --git a/src/registrar/tests/test_admin.py b/src/registrar/tests/test_admin.py index 42baae6ef..d6beb7456 100644 --- a/src/registrar/tests/test_admin.py +++ b/src/registrar/tests/test_admin.py @@ -95,6 +95,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 @@ -852,6 +869,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): """ @@ -2377,7 +2411,7 @@ class TestDomainRequestAdmin(MockEppLib): self.mock_client.EMAILS_SENT.clear() -class DomainInvitationAdminTest(TestCase): +class TestDomainInvitationAdmin(TestCase): """Tests for the DomainInvitation page""" def setUp(self): @@ -2393,6 +2427,26 @@ 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(): @@ -2442,6 +2496,26 @@ 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): """ @@ -2520,6 +2594,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): """ @@ -2763,7 +2854,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() @@ -2785,6 +2876,23 @@ 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(): @@ -2981,6 +3089,27 @@ 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): """ @@ -3407,7 +3536,7 @@ class DomainSessionVariableTest(TestCase): ) -class ContactAdminTest(TestCase): +class TestContactAdmin(TestCase): def setUp(self): self.site = AdminSite() self.factory = RequestFactory() @@ -3416,6 +3545,26 @@ 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("/") @@ -3534,6 +3683,27 @@ 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): """ From 9a2ee18cb9de206fdd8169e075019f3be89332b9 Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Fri, 26 Apr 2024 10:17:54 -0600 Subject: [PATCH 13/76] Add domain invitation content --- .../templates/admin/model_descriptions.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/registrar/templates/admin/model_descriptions.html b/src/registrar/templates/admin/model_descriptions.html index 7120e5e6b..afe3f5131 100644 --- a/src/registrar/templates/admin/model_descriptions.html +++ b/src/registrar/templates/admin/model_descriptions.html @@ -32,6 +32,23 @@ (since a domain request should be maintained as-adjudicated for records retention purposes). Entries are created here upon approval of a domain request. + {% elif opts.model_name == 'domaininvitation' %} ++ 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. +
+ ++ 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. +
+ ++ If an invitation is created in this table, an email will not be sent. + To have an email sent, go to the domain in Domains, + click the “Manage domain” button, and add a domain manager. +
{% elif opts.model_name == 'contact' %}Contacts include anyone who has access to the registrar (known as “users”) and anyone listed in a domain request, From b89db7ff27690623c1040ee822ef81e5b80300dc Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Fri, 26 Apr 2024 10:34:26 -0600 Subject: [PATCH 14/76] Add missing unit tests --- .../templates/admin/model_descriptions.html | 28 +-- src/registrar/tests/test_admin.py | 238 ++++++++++++++++-- 2 files changed, 233 insertions(+), 33 deletions(-) diff --git a/src/registrar/templates/admin/model_descriptions.html b/src/registrar/templates/admin/model_descriptions.html index afe3f5131..f87bf61ca 100644 --- a/src/registrar/templates/admin/model_descriptions.html +++ b/src/registrar/templates/admin/model_descriptions.html @@ -33,22 +33,22 @@ Entries are created here upon approval of a domain request.
{% elif opts.model_name == 'domaininvitation' %} -- 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. -
++ 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. +
-- 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. -
++ 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. +
-- If an invitation is created in this table, an email will not be sent. - To have an email sent, go to the domain in Domains, - click the “Manage domain” button, and add a domain manager. -
++ If an invitation is created in this table, an email will not be sent. + To have an email sent, go to the domain in Domains, + click the “Manage domain” button, and add a domain manager. +
{% elif opts.model_name == 'contact' %}Contacts include anyone who has access to the registrar (known as “users”) and anyone listed in a domain request, diff --git a/src/registrar/tests/test_admin.py b/src/registrar/tests/test_admin.py index d6beb7456..6065f85b9 100644 --- a/src/registrar/tests/test_admin.py +++ b/src/registrar/tests/test_admin.py @@ -21,6 +21,13 @@ from registrar.admin import ( MyHostAdmin, UserDomainRoleAdmin, VerifiedByStaffAdmin, + WebsiteAdmin, + DraftDomainAdmin, + FederalAgencyAdmin, + PublicContactAdmin, + TransitionDomainAdmin, + UserGroupAdmin, + TransitionDomainAdmin, ) from registrar.models import ( Domain, @@ -33,6 +40,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 @@ -2442,8 +2452,7 @@ class TestDomainInvitationAdmin(TestCase): # Test for a description snippet self.assertContains( - response, - "Domain invitations contain all individuals who have been invited to manage a .gov domain." + response, "Domain invitations contain all individuals who have been invited to manage a .gov domain." ) self.assertContains(response, "Show more") @@ -2510,10 +2519,7 @@ class TestHostAdmin(TestCase): 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, "Entries in the Hosts table indicate the relationship between an approved domain") self.assertContains(response, "Show more") @less_console_noise_decorator @@ -2890,7 +2896,9 @@ class TestUserDomainRoleAdmin(TestCase): 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, "This table represents the managers who are assigned to each domain in the registrar" + ) self.assertContains(response, "Show more") def test_domain_sortable(self): @@ -3103,13 +3111,9 @@ class TestMyUserAdmin(TestCase): 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, "A user is anyone who has access to the registrar.") self.assertContains(response, "Show more") - @less_console_noise_decorator def test_helper_text(self): """ @@ -3559,10 +3563,7 @@ class TestContactAdmin(TestCase): 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, "Contacts include anyone who has access to the registrar (known as “users”)") self.assertContains(response, "Show more") def test_readonly_when_restricted_staffuser(self): @@ -3698,9 +3699,7 @@ class TestVerifiedByStaffAdmin(TestCase): # Test for a description snippet self.assertContains( - response, - "This table contains users who have been allowed to bypass " - "identity proofing through Login.gov" + response, "This table contains users who have been allowed to bypass " "identity proofing through Login.gov" ) self.assertContains(response, "Show more") @@ -3746,3 +3745,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.assertNotContains(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") From d760f2dab4b64e7217c3f623fb9c09382cbdd684 Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Fri, 26 Apr 2024 10:45:13 -0600 Subject: [PATCH 15/76] Fix unit tests --- src/registrar/tests/test_admin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/registrar/tests/test_admin.py b/src/registrar/tests/test_admin.py index 6065f85b9..88f00bfcb 100644 --- a/src/registrar/tests/test_admin.py +++ b/src/registrar/tests/test_admin.py @@ -538,7 +538,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=39) # This may be a bit more robust self.assertContains(response, '
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.
From 9daa6ddafefa28b005f7bc4ff11239eeb048a92d Mon Sep 17 00:00:00 2001
From: zandercymatics <141044360+zandercymatics@users.noreply.github.com>
Date: Fri, 26 Apr 2024 12:06:20 -0600
Subject: [PATCH 18/76] Change style
---
.../templates/admin/model_descriptions.html | 24 +++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/registrar/templates/admin/model_descriptions.html b/src/registrar/templates/admin/model_descriptions.html
index 5599baf18..6469f6188 100644
--- a/src/registrar/templates/admin/model_descriptions.html
+++ b/src/registrar/templates/admin/model_descriptions.html
@@ -9,7 +9,7 @@
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 Domains.
+ go to Domains.
Similar fields display on each Domain page, but edits made there will not affect the corresponding domain request.
@@ -25,7 +25,7 @@
- Domain information is similar to Domain requests, + Domain information is similar to Domain requests, 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 @@ -46,7 +46,7 @@
If an invitation is created in this table, an email will not be sent. - To have an email sent, go to the domain in Domains, + To have an email sent, go to the domain in Domains, click the “Manage domain” button, and add a domain manager.
{% elif opts.model_name == 'contact' %} @@ -54,7 +54,7 @@ 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 Users table. + a corresponding record within the Users table. Updating someone’s contact information here will not affect that person’s Login.gov information. {% elif opts.model_name == 'logentry' %} @@ -63,7 +63,7 @@ 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 - (Domain requests) and click on the “History” button. + (Domain requests) and click on the “History” button. {% elif opts.model_name == 'domain'%}@@ -100,7 +100,7 @@
This table does not include “alternative domains,” - which are housed in the Websites table. + which are housed in the Websites table.
{% elif opts.model_name == 'host' %}@@ -111,7 +111,7 @@
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 Domains, + in the registrar, go to the domain in Domains, then click the "Manage domain" button.
{% elif opts.model_name == 'publiccontact' %} @@ -152,7 +152,7 @@ {% elif opts.model_name == 'usergroup' %}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 Users table. + Once a group is created, it can be assigned to people via the Users table.
@@ -174,7 +174,7 @@
Each user record displays the associated “contact” info for that user, - which is the same info found in the Contacts table. + which is the same info found in the Contacts table. Updating these details on the user record will also update the corresponding contact record for that user.
{% elif opts.model_name == 'verifiedbystaff' %} @@ -194,8 +194,8 @@- This does not include any “requested domains” that have appeared within the Domain requests table. - Those names are managed in the Draft domains table. + This does not include any “requested domains” that have appeared within the Domain requests table. + Those names are managed in the Draft domains table.
{% else %}This table does not have a description yet.
From 781b9f7b810b9003e745b96ce9f608937bf43aa8 Mon Sep 17 00:00:00 2001 From: Rachid Mrad