mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 09:21:54 +02:00
Merge pull request #1687 from cisagov/za/1274-protect-domain-link
(on getgov-backup) Ticket #1274: Protect domain link
This commit is contained in:
commit
2a626a8638
2 changed files with 26 additions and 1 deletions
|
@ -677,6 +677,7 @@ class DomainInformationAdmin(ListHeaderAdmin):
|
|||
"type_of_work",
|
||||
"more_organization_information",
|
||||
"domain",
|
||||
"domain_application",
|
||||
"submitter",
|
||||
"no_other_contacts_rationale",
|
||||
"anything_else",
|
||||
|
@ -845,6 +846,7 @@ class DomainApplicationAdmin(ListHeaderAdmin):
|
|||
"creator",
|
||||
"about_your_organization",
|
||||
"requested_domain",
|
||||
"approved_domain",
|
||||
"alternative_domains",
|
||||
"purpose",
|
||||
"submitter",
|
||||
|
|
|
@ -632,6 +632,7 @@ class TestDomainApplicationAdmin(MockEppLib):
|
|||
"creator",
|
||||
"about_your_organization",
|
||||
"requested_domain",
|
||||
"approved_domain",
|
||||
"alternative_domains",
|
||||
"purpose",
|
||||
"submitter",
|
||||
|
@ -1057,7 +1058,7 @@ class DomainInvitationAdminTest(TestCase):
|
|||
self.assertContains(response, retrieved_html, count=1)
|
||||
|
||||
|
||||
class DomainInformationAdminTest(TestCase):
|
||||
class TestDomainInformationAdmin(TestCase):
|
||||
def setUp(self):
|
||||
"""Setup environment for a mock admin user"""
|
||||
self.site = AdminSite()
|
||||
|
@ -1065,6 +1066,7 @@ class DomainInformationAdminTest(TestCase):
|
|||
self.admin = DomainInformationAdmin(model=DomainInformation, admin_site=self.site)
|
||||
self.client = Client(HTTP_HOST="localhost:8080")
|
||||
self.superuser = create_superuser()
|
||||
self.staffuser = create_user()
|
||||
self.mock_data_generator = AuditedAdminMockData()
|
||||
|
||||
self.test_helper = GenericTestHelper(
|
||||
|
@ -1108,6 +1110,27 @@ class DomainInformationAdminTest(TestCase):
|
|||
Contact.objects.all().delete()
|
||||
User.objects.all().delete()
|
||||
|
||||
def test_readonly_fields_for_analyst(self):
|
||||
"""Ensures that analysts have their permissions setup correctly"""
|
||||
request = self.factory.get("/")
|
||||
request.user = self.staffuser
|
||||
|
||||
readonly_fields = self.admin.get_readonly_fields(request)
|
||||
|
||||
expected_fields = [
|
||||
"creator",
|
||||
"type_of_work",
|
||||
"more_organization_information",
|
||||
"domain",
|
||||
"domain_application",
|
||||
"submitter",
|
||||
"no_other_contacts_rationale",
|
||||
"anything_else",
|
||||
"is_policy_acknowledged",
|
||||
]
|
||||
|
||||
self.assertEqual(readonly_fields, expected_fields)
|
||||
|
||||
def test_domain_sortable(self):
|
||||
"""Tests if DomainInformation sorts by domain correctly"""
|
||||
p = "adminpass"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue