mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-15 17:17:02 +02:00
fix org in domain table and write a unit test for it
This commit is contained in:
parent
372ead1121
commit
02a9c98a57
2 changed files with 25 additions and 2 deletions
|
@ -721,7 +721,7 @@ class DomainAdmin(ListHeaderAdmin):
|
||||||
]
|
]
|
||||||
|
|
||||||
def organization_type(self, obj):
|
def organization_type(self, obj):
|
||||||
return obj.domain_info.organization_type
|
return obj.domain_info.get_organization_type_display()
|
||||||
|
|
||||||
organization_type.admin_order_field = ( # type: ignore
|
organization_type.admin_order_field = ( # type: ignore
|
||||||
"domain_info__organization_type"
|
"domain_info__organization_type"
|
||||||
|
|
|
@ -52,6 +52,26 @@ class TestDomainAdmin(MockEppLib):
|
||||||
self.factory = RequestFactory()
|
self.factory = RequestFactory()
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
|
||||||
|
def test_short_org_name_in_domains_list(self):
|
||||||
|
"""
|
||||||
|
Make sure the short name is displaying in admin on the list page
|
||||||
|
"""
|
||||||
|
self.client.force_login(self.superuser)
|
||||||
|
application = completed_application(status=DomainApplication.IN_REVIEW)
|
||||||
|
application.approve()
|
||||||
|
|
||||||
|
response = self.client.get("/admin/registrar/domain/")
|
||||||
|
|
||||||
|
# There are 3 template references to Federal (3) plus one reference in the table
|
||||||
|
# for our actual application
|
||||||
|
self.assertContains(response, "Federal", count=4)
|
||||||
|
# This may be a bit more robust
|
||||||
|
self.assertContains(
|
||||||
|
response, '<td class="field-organization_type">Federal</td>', count=1
|
||||||
|
)
|
||||||
|
# Now let's make sure the long description does not exist
|
||||||
|
self.assertNotContains(response, "Federal: an agency of the U.S. government")
|
||||||
|
|
||||||
@skip("Why did this test stop working, and is is a good test")
|
@skip("Why did this test stop working, and is is a good test")
|
||||||
def test_place_and_remove_hold(self):
|
def test_place_and_remove_hold(self):
|
||||||
domain = create_ready_domain()
|
domain = create_ready_domain()
|
||||||
|
@ -243,8 +263,11 @@ class TestDomainAdmin(MockEppLib):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
User.objects.all().delete()
|
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
Domain.objects.all().delete()
|
||||||
|
DomainInformation.objects.all().delete()
|
||||||
|
DomainApplication.objects.all().delete()
|
||||||
|
User.objects.all().delete()
|
||||||
|
|
||||||
|
|
||||||
class TestDomainApplicationAdminForm(TestCase):
|
class TestDomainApplicationAdminForm(TestCase):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue