diff --git a/src/registrar/tests/test_admin.py b/src/registrar/tests/test_admin.py index 8e83dedde..49bd1f299 100644 --- a/src/registrar/tests/test_admin.py +++ b/src/registrar/tests/test_admin.py @@ -131,7 +131,7 @@ class TestDomainAdmin(MockEppLib, WebTest): @less_console_noise_decorator def test_analyst_can_see_inline_domain_information_in_domain_change_form(self): - """Tests if the analyst can still see the inline domain information form""" + """Tests if an analyst can still see the inline domain information form""" # Create fake creator _creator = User.objects.create( @@ -151,7 +151,7 @@ class TestDomainAdmin(MockEppLib, WebTest): domain_information.save() # We use filter here rather than just domain_information.domain just to get the latest data. - domain = Domain.objects.filter(domain=domain_information.domain) + domain = Domain.objects.filter(domain_info=domain_information) p = "userpass" self.client.login(username="staffuser", password=p) @@ -172,6 +172,48 @@ class TestDomainAdmin(MockEppLib, WebTest): expected_organization_name = "MonkeySeeMonkeyDo" self.assertContains(response, expected_organization_name) + @less_console_noise_decorator + def test_admin_can_see_inline_domain_information_in_domain_change_form(self): + """Tests if an admin can still see the inline domain information form""" + # Create fake creator + _creator = User.objects.create( + username="MrMeoward", + first_name="Meoward", + last_name="Jones", + ) + + # Create a fake domain request + _domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW, user=_creator) + + # Creates a Domain and DomainInformation object + _domain_request.approve() + + domain_information = DomainInformation.objects.filter(domain_request=_domain_request).get() + domain_information.organization_name = "MonkeySeeMonkeyDo" + domain_information.save() + + # We use filter here rather than just domain_information.domain just to get the latest data. + domain = Domain.objects.filter(domain_info=domain_information) + + p = "adminpass" + self.client.login(username="superuser", password=p) + response = self.client.get( + "/admin/registrar/domain/{}/change/".format(domain.pk), + follow=True, + ) + + # Make sure the page loaded, and that we're on the right page + self.assertEqual(response.status_code, 200) + self.assertContains(response, domain.name) + + # Check for one of the inline headers + expected_header = ".gov domain" + self.assertContains(response, expected_header) + + # Test for data. We only need to test one since its all interconnected. + expected_organization_name = "MonkeySeeMonkeyDo" + self.assertContains(response, expected_organization_name) + @patch("registrar.admin.DomainAdmin._get_current_date", return_value=date(2024, 1, 1)) def test_extend_expiration_date_button_epp(self, mock_date_today): """