Remove submitter from model tests

This commit is contained in:
Erin Song 2024-08-26 15:59:48 -07:00
parent 2f2b2fe10f
commit 2713e59795
No known key found for this signature in database
9 changed files with 57 additions and 118 deletions

View file

@ -1137,6 +1137,10 @@ class DomainRequest(TimeStampedModel):
# Special District -> "Election office" and "About your organization" page can't be empty # Special District -> "Election office" and "About your organization" page can't be empty
return self.is_election_board is not None and self.about_your_organization is not None return self.is_election_board is not None and self.about_your_organization is not None
# Do we still want to test this after creator is autogenerated? Currently it went back to being selectable
def _is_creator_complete(self):
return self.creator is not None
def _is_organization_name_and_address_complete(self): def _is_organization_name_and_address_complete(self):
return not ( return not (
self.organization_name is None self.organization_name is None
@ -1205,7 +1209,8 @@ class DomainRequest(TimeStampedModel):
def _is_general_form_complete(self, request): def _is_general_form_complete(self, request):
has_profile_feature_flag = flag_is_active(request, "profile_feature") has_profile_feature_flag = flag_is_active(request, "profile_feature")
return ( return (
self._is_organization_name_and_address_complete() self._is_creator_complete()
and self._is_organization_name_and_address_complete()
and self._is_senior_official_complete() and self._is_senior_official_complete()
and self._is_requested_domain_complete() and self._is_requested_domain_complete()
and self._is_purpose_complete() and self._is_purpose_complete()

View file

@ -392,7 +392,6 @@ class AuditedAdminMockData:
about_your_organization: str = "e-Government", about_your_organization: str = "e-Government",
anything_else: str = "There is more", anything_else: str = "There is more",
senior_official: Contact = self.dummy_contact(item_name, "senior_official"), senior_official: Contact = self.dummy_contact(item_name, "senior_official"),
submitter: Contact = self.dummy_contact(item_name, "submitter"),
creator: User = self.dummy_user(item_name, "creator"), creator: User = self.dummy_user(item_name, "creator"),
} }
""" # noqa """ # noqa
@ -410,7 +409,6 @@ class AuditedAdminMockData:
about_your_organization="e-Government", about_your_organization="e-Government",
anything_else="There is more", anything_else="There is more",
senior_official=self.dummy_contact(item_name, "senior_official"), senior_official=self.dummy_contact(item_name, "senior_official"),
submitter=self.dummy_contact(item_name, "submitter"),
creator=creator, creator=creator,
) )
return common_args return common_args
@ -897,7 +895,6 @@ def completed_domain_request( # noqa
has_cisa_representative=True, has_cisa_representative=True,
status=DomainRequest.DomainRequestStatus.STARTED, status=DomainRequest.DomainRequestStatus.STARTED,
user=False, user=False,
submitter=False,
name="city.gov", name="city.gov",
investigator=None, investigator=None,
generic_org_type="federal", generic_org_type="federal",
@ -921,14 +918,14 @@ def completed_domain_request( # noqa
domain, _ = DraftDomain.objects.get_or_create(name=name) domain, _ = DraftDomain.objects.get_or_create(name=name)
alt, _ = Website.objects.get_or_create(website="city1.gov") alt, _ = Website.objects.get_or_create(website="city1.gov")
current, _ = Website.objects.get_or_create(website="city.com") current, _ = Website.objects.get_or_create(website="city.com")
if not submitter: # if not creator:
submitter, _ = Contact.objects.get_or_create( # creator, _ = Contact.objects.get_or_create(
first_name="Testy2", # first_name="Testy2",
last_name="Tester2", # last_name="Tester2",
title="Admin Tester", # title="Admin Tester",
email="mayor@igorville.gov", # email="mayor@igorville.gov",
phone="(555) 555 5556", # phone="(555) 555 5556",
) # )
other, _ = Contact.objects.get_or_create( other, _ = Contact.objects.get_or_create(
first_name="Testy", first_name="Testy",
last_name="Tester", last_name="Tester",
@ -957,7 +954,6 @@ def completed_domain_request( # noqa
zipcode="10002", zipcode="10002",
senior_official=so, senior_official=so,
requested_domain=domain, requested_domain=domain,
submitter=submitter,
creator=user, creator=user,
status=status, status=status,
investigator=investigator, investigator=investigator,

View file

@ -380,7 +380,7 @@ class TestDomainInformationAdmin(TestCase):
contact, _ = Contact.objects.get_or_create(first_name="Henry", last_name="McFakerson") contact, _ = Contact.objects.get_or_create(first_name="Henry", last_name="McFakerson")
domain_request = completed_domain_request( domain_request = completed_domain_request(
submitter=contact, name="city1244.gov", status=DomainRequest.DomainRequestStatus.IN_REVIEW name="city1244.gov", status=DomainRequest.DomainRequestStatus.IN_REVIEW
) )
domain_request.approve() domain_request.approve()
@ -505,7 +505,6 @@ class TestDomainInformationAdmin(TestCase):
# These should exist in the response # These should exist in the response
expected_values = [ expected_values = [
("creator", "Person who submitted the domain request"), ("creator", "Person who submitted the domain request"),
("submitter", 'Person listed under "your contact information" in the request form'),
("domain_request", "Request associated with this domain"), ("domain_request", "Request associated with this domain"),
("no_other_contacts_rationale", "Required if creator does not list other employees"), ("no_other_contacts_rationale", "Required if creator does not list other employees"),
("urbanization", "Required for Puerto Rico only"), ("urbanization", "Required for Puerto Rico only"),
@ -629,16 +628,6 @@ class TestDomainInformationAdmin(TestCase):
# Check for the field itself # Check for the field itself
self.assertContains(response, "Meoward Jones") self.assertContains(response, "Meoward Jones")
# == Check for the submitter == #
self.assertContains(response, "mayor@igorville.gov", count=2)
expected_submitter_fields = [
# Field, expected value
("title", "Admin Tester"),
("phone", "(555) 555 5556"),
]
self.test_helper.assert_response_contains_distinct_values(response, expected_submitter_fields)
self.assertContains(response, "Testy2 Tester2")
# == Check for the senior_official == # # == Check for the senior_official == #
self.assertContains(response, "testy@town.com", count=2) self.assertContains(response, "testy@town.com", count=2)
expected_so_fields = [ expected_so_fields = [
@ -684,7 +673,6 @@ class TestDomainInformationAdmin(TestCase):
"more_organization_information", "more_organization_information",
"domain", "domain",
"domain_request", "domain_request",
"submitter",
"no_other_contacts_rationale", "no_other_contacts_rationale",
"anything_else", "anything_else",
"is_policy_acknowledged", "is_policy_acknowledged",
@ -703,19 +691,19 @@ class TestDomainInformationAdmin(TestCase):
# Assert that sorting in reverse works correctly # Assert that sorting in reverse works correctly
self.test_helper.assert_table_sorted("-1", ("-domain__name",)) self.test_helper.assert_table_sorted("-1", ("-domain__name",))
def test_submitter_sortable(self): def test_creator_sortable(self):
"""Tests if DomainInformation sorts by submitter correctly""" """Tests if DomainInformation sorts by creator correctly"""
with less_console_noise(): with less_console_noise():
self.client.force_login(self.superuser) self.client.force_login(self.superuser)
# Assert that our sort works correctly # Assert that our sort works correctly
self.test_helper.assert_table_sorted( self.test_helper.assert_table_sorted(
"4", "4",
("submitter__first_name", "submitter__last_name"), ("creator__first_name", "creator__last_name"),
) )
# Assert that sorting in reverse works correctly # Assert that sorting in reverse works correctly
self.test_helper.assert_table_sorted("-4", ("-submitter__first_name", "-submitter__last_name")) self.test_helper.assert_table_sorted("-4", ("-creator__first_name", "-creator__last_name"))
class TestUserDomainRoleAdmin(TestCase): class TestUserDomainRoleAdmin(TestCase):
@ -1298,7 +1286,6 @@ class AuditedAdminTest(TestCase):
# Senior offical is commented out for now - this is alphabetized # Senior offical is commented out for now - this is alphabetized
# and this test does not accurately reflect that. # and this test does not accurately reflect that.
# DomainRequest.senior_official.field, # DomainRequest.senior_official.field,
DomainRequest.submitter.field,
# DomainRequest.investigator.field, # DomainRequest.investigator.field,
DomainRequest.creator.field, DomainRequest.creator.field,
DomainRequest.requested_domain.field, DomainRequest.requested_domain.field,
@ -1358,7 +1345,6 @@ class AuditedAdminTest(TestCase):
# Senior offical is commented out for now - this is alphabetized # Senior offical is commented out for now - this is alphabetized
# and this test does not accurately reflect that. # and this test does not accurately reflect that.
# DomainInformation.senior_official.field, # DomainInformation.senior_official.field,
DomainInformation.submitter.field,
# DomainInformation.creator.field, # DomainInformation.creator.field,
(DomainInformation.domain.field, ["name"]), (DomainInformation.domain.field, ["name"]),
(DomainInformation.domain_request.field, ["requested_domain__name"]), (DomainInformation.domain_request.field, ["requested_domain__name"]),
@ -1680,10 +1666,10 @@ class TestContactAdmin(TestCase):
) )
# join it to 4 domain requests. # join it to 4 domain requests.
domain_request1 = completed_domain_request(submitter=contact, name="city1.gov") domain_request1 = completed_domain_request(name="city1.gov")
domain_request2 = completed_domain_request(submitter=contact, name="city2.gov") domain_request2 = completed_domain_request(name="city2.gov")
domain_request3 = completed_domain_request(submitter=contact, name="city3.gov") domain_request3 = completed_domain_request(name="city3.gov")
domain_request4 = completed_domain_request(submitter=contact, name="city4.gov") domain_request4 = completed_domain_request(name="city4.gov")
with patch("django.contrib.messages.warning") as mock_warning: with patch("django.contrib.messages.warning") as mock_warning:
# Use the test client to simulate the request # Use the test client to simulate the request
@ -1720,12 +1706,12 @@ class TestContactAdmin(TestCase):
first_name="Henry", first_name="Henry",
last_name="McFakerson", last_name="McFakerson",
) )
domain_request1 = completed_domain_request(submitter=contact, name="city1.gov") domain_request1 = completed_domain_request(name="city1.gov")
domain_request2 = completed_domain_request(submitter=contact, name="city2.gov") domain_request2 = completed_domain_request(name="city2.gov")
domain_request3 = completed_domain_request(submitter=contact, name="city3.gov") domain_request3 = completed_domain_request(name="city3.gov")
domain_request4 = completed_domain_request(submitter=contact, name="city4.gov") domain_request4 = completed_domain_request(name="city4.gov")
domain_request5 = completed_domain_request(submitter=contact, name="city5.gov") domain_request5 = completed_domain_request(name="city5.gov")
completed_domain_request(submitter=contact, name="city6.gov") completed_domain_request(name="city6.gov")
with patch("django.contrib.messages.warning") as mock_warning: with patch("django.contrib.messages.warning") as mock_warning:
# Use the test client to simulate the request # Use the test client to simulate the request
response = self.client.get(reverse("admin:registrar_contact_change", args=[contact.pk])) response = self.client.get(reverse("admin:registrar_contact_change", args=[contact.pk]))

View file

@ -423,13 +423,6 @@ class TestDomainAdminWithClient(TestCase):
# Check for the field itself # Check for the field itself
self.assertContains(response, "Meoward Jones") self.assertContains(response, "Meoward Jones")
# == Check for the submitter == #
self.assertContains(response, "mayor@igorville.gov")
self.assertContains(response, "Admin Tester")
self.assertContains(response, "(555) 555 5556")
self.assertContains(response, "Testy2 Tester2")
# == Check for the senior_official == # # == Check for the senior_official == #
self.assertContains(response, "testy@town.com") self.assertContains(response, "testy@town.com")
self.assertContains(response, "Chief Tester") self.assertContains(response, "Chief Tester")

View file

@ -94,7 +94,7 @@ class TestDomainRequestAdmin(MockEppLib):
SeniorOfficial.objects.get_or_create(first_name="Zoup", last_name="Soup", title="title") SeniorOfficial.objects.get_or_create(first_name="Zoup", last_name="Soup", title="title")
contact, _ = Contact.objects.get_or_create(first_name="Henry", last_name="McFakerson") contact, _ = Contact.objects.get_or_create(first_name="Henry", last_name="McFakerson")
domain_request = completed_domain_request(submitter=contact, name="city1.gov") domain_request = completed_domain_request(name="city1.gov")
request = self.factory.post("/admin/registrar/domainrequest/{}/change/".format(domain_request.pk)) request = self.factory.post("/admin/registrar/domainrequest/{}/change/".format(domain_request.pk))
model_admin = AuditedAdmin(DomainRequest, self.site) model_admin = AuditedAdmin(DomainRequest, self.site)
@ -150,10 +150,6 @@ class TestDomainRequestAdmin(MockEppLib):
# These should exist in the response # These should exist in the response
expected_values = [ expected_values = [
("creator", "Person who submitted the domain request; will not receive email updates"), ("creator", "Person who submitted the domain request; will not receive email updates"),
(
"submitter",
'Person listed under "your contact information" in the request form; will receive email updates',
),
("approved_domain", "Domain associated with this request; will be blank until request is approved"), ("approved_domain", "Domain associated with this request; will be blank until request is approved"),
("no_other_contacts_rationale", "Required if creator does not list other employees"), ("no_other_contacts_rationale", "Required if creator does not list other employees"),
("alternative_domains", "Other domain names the creator provided for consideration"), ("alternative_domains", "Other domain names the creator provided for consideration"),
@ -409,8 +405,8 @@ class TestDomainRequestAdmin(MockEppLib):
self.test_helper.assert_table_sorted("-1", ("-requested_domain__name",)) self.test_helper.assert_table_sorted("-1", ("-requested_domain__name",))
@less_console_noise_decorator @less_console_noise_decorator
def test_submitter_sortable(self): def test_creator_sortable(self):
"""Tests if the DomainRequest sorts by submitter correctly""" """Tests if the DomainRequest sorts by creator correctly"""
self.client.force_login(self.superuser) self.client.force_login(self.superuser)
multiple_unalphabetical_domain_objects("domain_request") multiple_unalphabetical_domain_objects("domain_request")
@ -424,8 +420,8 @@ class TestDomainRequestAdmin(MockEppLib):
self.test_helper.assert_table_sorted( self.test_helper.assert_table_sorted(
"11", "11",
( (
"submitter__first_name", "creator__first_name",
"submitter__last_name", "creator__last_name",
), ),
) )
@ -433,8 +429,8 @@ class TestDomainRequestAdmin(MockEppLib):
self.test_helper.assert_table_sorted( self.test_helper.assert_table_sorted(
"-11", "-11",
( (
"-submitter__first_name", "-creator__first_name",
"-submitter__last_name", "-creator__last_name",
), ),
) )
@ -1381,16 +1377,6 @@ class TestDomainRequestAdmin(MockEppLib):
# Check for the field itself # Check for the field itself
self.assertContains(response, "Meoward Jones") self.assertContains(response, "Meoward Jones")
# == Check for the submitter == #
self.assertContains(response, "mayor@igorville.gov", count=2)
expected_submitter_fields = [
# Field, expected value
("title", "Admin Tester"),
("phone", "(555) 555 5556"),
]
self.test_helper.assert_response_contains_distinct_values(response, expected_submitter_fields)
self.assertContains(response, "Testy2 Tester2")
# == Check for the senior_official == # # == Check for the senior_official == #
self.assertContains(response, "testy@town.com", count=2) self.assertContains(response, "testy@town.com", count=2)
expected_so_fields = [ expected_so_fields = [
@ -1546,7 +1532,6 @@ class TestDomainRequestAdmin(MockEppLib):
"senior_official", "senior_official",
"approved_domain", "approved_domain",
"requested_domain", "requested_domain",
"submitter",
"purpose", "purpose",
"no_other_contacts_rationale", "no_other_contacts_rationale",
"anything_else", "anything_else",
@ -1583,7 +1568,6 @@ class TestDomainRequestAdmin(MockEppLib):
"approved_domain", "approved_domain",
"alternative_domains", "alternative_domains",
"purpose", "purpose",
"submitter",
"no_other_contacts_rationale", "no_other_contacts_rationale",
"anything_else", "anything_else",
"is_policy_acknowledged", "is_policy_acknowledged",

View file

@ -168,7 +168,6 @@ class TestDomainRequest(TestCase):
zipcode="12345-6789", zipcode="12345-6789",
senior_official=contact, senior_official=contact,
requested_domain=domain, requested_domain=domain,
submitter=contact,
purpose="Igorville rules!", purpose="Igorville rules!",
anything_else="All of Igorville loves the dotgov program.", anything_else="All of Igorville loves the dotgov program.",
is_policy_acknowledged=True, is_policy_acknowledged=True,
@ -195,7 +194,6 @@ class TestDomainRequest(TestCase):
state_territory="CA", state_territory="CA",
zipcode="12345-6789", zipcode="12345-6789",
senior_official=contact, senior_official=contact,
submitter=contact,
purpose="Igorville rules!", purpose="Igorville rules!",
anything_else="All of Igorville loves the dotgov program.", anything_else="All of Igorville loves the dotgov program.",
is_policy_acknowledged=True, is_policy_acknowledged=True,
@ -258,7 +256,7 @@ class TestDomainRequest(TestCase):
@less_console_noise_decorator @less_console_noise_decorator
def test_submit_from_started_sends_email(self): def test_submit_from_started_sends_email(self):
msg = "Create a domain request and submit it and see if email was sent." msg = "Create a domain request and submit it and see if email was sent."
domain_request = completed_domain_request(submitter=self.dummy_user, user=self.dummy_user_2) domain_request = completed_domain_request(user=self.dummy_user_2)
self.check_email_sent(domain_request, msg, "submit", 1, expected_content="Hello") self.check_email_sent(domain_request, msg, "submit", 1, expected_content="Hello")
@override_flag("profile_feature", active=True) @override_flag("profile_feature", active=True)
@ -266,7 +264,7 @@ class TestDomainRequest(TestCase):
def test_submit_from_started_sends_email_to_creator(self): def test_submit_from_started_sends_email_to_creator(self):
"""Tests if, when the profile feature flag is on, we send an email to the creator""" """Tests if, when the profile feature flag is on, we send an email to the creator"""
msg = "Create a domain request and submit it and see if email was sent when the feature flag is on." msg = "Create a domain request and submit it and see if email was sent when the feature flag is on."
domain_request = completed_domain_request(submitter=self.dummy_user, user=self.dummy_user_2) domain_request = completed_domain_request(user=self.dummy_user_2)
self.check_email_sent( self.check_email_sent(
domain_request, msg, "submit", 1, expected_content="Lava", expected_email="intern@igorville.com" domain_request, msg, "submit", 1, expected_content="Lava", expected_email="intern@igorville.com"
) )
@ -275,7 +273,7 @@ class TestDomainRequest(TestCase):
def test_submit_from_withdrawn_sends_email(self): def test_submit_from_withdrawn_sends_email(self):
msg = "Create a withdrawn domain request and submit it and see if email was sent." msg = "Create a withdrawn domain request and submit it and see if email was sent."
domain_request = completed_domain_request( domain_request = completed_domain_request(
status=DomainRequest.DomainRequestStatus.WITHDRAWN, submitter=self.dummy_user status=DomainRequest.DomainRequestStatus.WITHDRAWN
) )
self.check_email_sent(domain_request, msg, "submit", 1, expected_content="Hello") self.check_email_sent(domain_request, msg, "submit", 1, expected_content="Hello")
@ -294,25 +292,19 @@ class TestDomainRequest(TestCase):
@less_console_noise_decorator @less_console_noise_decorator
def test_approve_sends_email(self): def test_approve_sends_email(self):
msg = "Create a domain request and approve it and see if email was sent." msg = "Create a domain request and approve it and see if email was sent."
domain_request = completed_domain_request( domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
status=DomainRequest.DomainRequestStatus.IN_REVIEW, submitter=self.dummy_user
)
self.check_email_sent(domain_request, msg, "approve", 1, expected_content="Hello") self.check_email_sent(domain_request, msg, "approve", 1, expected_content="Hello")
@less_console_noise_decorator @less_console_noise_decorator
def test_withdraw_sends_email(self): def test_withdraw_sends_email(self):
msg = "Create a domain request and withdraw it and see if email was sent." msg = "Create a domain request and withdraw it and see if email was sent."
domain_request = completed_domain_request( domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
status=DomainRequest.DomainRequestStatus.IN_REVIEW, submitter=self.dummy_user
)
self.check_email_sent(domain_request, msg, "withdraw", 1, expected_content="Hello") self.check_email_sent(domain_request, msg, "withdraw", 1, expected_content="Hello")
@less_console_noise_decorator @less_console_noise_decorator
def test_reject_sends_email(self): def test_reject_sends_email(self):
msg = "Create a domain request and reject it and see if email was sent." msg = "Create a domain request and reject it and see if email was sent."
domain_request = completed_domain_request( domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.APPROVED)
status=DomainRequest.DomainRequestStatus.APPROVED, submitter=self.dummy_user
)
self.check_email_sent(domain_request, msg, "reject", 1, expected_content="Hello") self.check_email_sent(domain_request, msg, "reject", 1, expected_content="Hello")
@less_console_noise_decorator @less_console_noise_decorator
@ -1877,7 +1869,6 @@ class TestDomainRequestIncomplete(TestCase):
senior_official=so, senior_official=so,
requested_domain=draft_domain, requested_domain=draft_domain,
purpose="Some purpose", purpose="Some purpose",
submitter=you,
no_other_contacts_rationale=None, no_other_contacts_rationale=None,
has_cisa_representative=True, has_cisa_representative=True,
cisa_representative_email="somerep@cisa.com", cisa_representative_email="somerep@cisa.com",
@ -2007,11 +1998,11 @@ class TestDomainRequestIncomplete(TestCase):
self.assertFalse(self.domain_request._is_purpose_complete()) self.assertFalse(self.domain_request._is_purpose_complete())
@less_console_noise_decorator @less_console_noise_decorator
def test_is_submitter_complete(self): def test_is_creator_complete(self):
self.assertTrue(self.domain_request._is_submitter_complete()) self.assertTrue(self.domain_request._is_creator_complete())
self.domain_request.submitter = None self.domain_request.creator = None
self.domain_request.save() self.domain_request.save()
self.assertFalse(self.domain_request._is_submitter_complete()) self.assertFalse(self.domain_request._is_creator_complete())
@less_console_noise_decorator @less_console_noise_decorator
def test_is_other_contacts_complete_missing_one_field(self): def test_is_other_contacts_complete_missing_one_field(self):

View file

@ -381,7 +381,6 @@ class HomeTests(TestWithUser):
requested_domain=site, requested_domain=site,
status=DomainRequest.DomainRequestStatus.WITHDRAWN, status=DomainRequest.DomainRequestStatus.WITHDRAWN,
senior_official=contact, senior_official=contact,
submitter=contact_user,
) )
domain_request.other_contacts.set([contact_2]) domain_request.other_contacts.set([contact_2])
@ -392,7 +391,6 @@ class HomeTests(TestWithUser):
requested_domain=site_2, requested_domain=site_2,
status=DomainRequest.DomainRequestStatus.STARTED, status=DomainRequest.DomainRequestStatus.STARTED,
senior_official=contact_2, senior_official=contact_2,
submitter=contact_shared,
) )
domain_request_2.other_contacts.set([contact_shared]) domain_request_2.other_contacts.set([contact_shared])
@ -455,7 +453,6 @@ class HomeTests(TestWithUser):
requested_domain=site, requested_domain=site,
status=DomainRequest.DomainRequestStatus.WITHDRAWN, status=DomainRequest.DomainRequestStatus.WITHDRAWN,
senior_official=contact, senior_official=contact,
submitter=contact_user,
) )
domain_request.other_contacts.set([contact_2]) domain_request.other_contacts.set([contact_2])
@ -466,7 +463,6 @@ class HomeTests(TestWithUser):
requested_domain=site_2, requested_domain=site_2,
status=DomainRequest.DomainRequestStatus.STARTED, status=DomainRequest.DomainRequestStatus.STARTED,
senior_official=contact_2, senior_official=contact_2,
submitter=contact_shared,
) )
domain_request_2.other_contacts.set([contact_shared]) domain_request_2.other_contacts.set([contact_shared])
@ -1038,7 +1034,6 @@ class UserProfileTests(TestWithUser, WebTest):
requested_domain=site, requested_domain=site,
status=DomainRequest.DomainRequestStatus.SUBMITTED, status=DomainRequest.DomainRequestStatus.SUBMITTED,
senior_official=contact_user, senior_official=contact_user,
submitter=contact_user,
) )
with override_flag("profile_feature", active=True): with override_flag("profile_feature", active=True):
response = self.client.get(f"/domain-request/{domain_request.id}", follow=True) response = self.client.get(f"/domain-request/{domain_request.id}", follow=True)
@ -1060,7 +1055,6 @@ class UserProfileTests(TestWithUser, WebTest):
requested_domain=site, requested_domain=site,
status=DomainRequest.DomainRequestStatus.SUBMITTED, status=DomainRequest.DomainRequestStatus.SUBMITTED,
senior_official=contact_user, senior_official=contact_user,
submitter=contact_user,
) )
with override_flag("profile_feature", active=False): with override_flag("profile_feature", active=False):
response = self.client.get(f"/domain-request/{domain_request.id}", follow=True) response = self.client.get(f"/domain-request/{domain_request.id}", follow=True)

View file

@ -368,11 +368,11 @@ class DomainRequestTests(TestWithUser, WebTest):
your_contact_result = your_contact_form.submit() your_contact_result = your_contact_form.submit()
# validate that data from this step are being saved # validate that data from this step are being saved
domain_request = DomainRequest.objects.get() # there's only one domain_request = DomainRequest.objects.get() # there's only one
self.assertEqual(domain_request.submitter.first_name, "Testy you") self.assertEqual(domain_request.creator.first_name, self.user.first_name)
self.assertEqual(domain_request.submitter.last_name, "Tester you") self.assertEqual(domain_request.creator.last_name, self.user.last_name)
self.assertEqual(domain_request.submitter.title, "Admin Tester") self.assertEqual(domain_request.creator.title, self.user.title)
self.assertEqual(domain_request.submitter.email, "testy-admin@town.com") self.assertEqual(domain_request.creator.email, self.user.email)
self.assertEqual(domain_request.submitter.phone, "(201) 555 5556") self.assertEqual(domain_request.creator.phone, self.user.phone)
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the domain request page # the domain request page
self.assertEqual(your_contact_result.status_code, 302) self.assertEqual(your_contact_result.status_code, 302)
@ -1643,7 +1643,6 @@ class DomainRequestTests(TestWithUser, WebTest):
state_territory="NY", state_territory="NY",
zipcode="10002", zipcode="10002",
senior_official=so, senior_official=so,
submitter=you,
creator=self.user, creator=self.user,
status="started", status="started",
) )
@ -1780,7 +1779,6 @@ class DomainRequestTests(TestWithUser, WebTest):
state_territory="NY", state_territory="NY",
zipcode="10002", zipcode="10002",
senior_official=so, senior_official=so,
submitter=you,
creator=self.user, creator=self.user,
status="started", status="started",
) )
@ -1855,7 +1853,6 @@ class DomainRequestTests(TestWithUser, WebTest):
state_territory="NY", state_territory="NY",
zipcode="10002", zipcode="10002",
senior_official=so, senior_official=so,
submitter=you,
creator=self.user, creator=self.user,
status="started", status="started",
) )
@ -1933,7 +1930,6 @@ class DomainRequestTests(TestWithUser, WebTest):
state_territory="NY", state_territory="NY",
zipcode="10002", zipcode="10002",
senior_official=so, senior_official=so,
submitter=you,
creator=self.user, creator=self.user,
status="started", status="started",
) )
@ -2010,7 +2006,6 @@ class DomainRequestTests(TestWithUser, WebTest):
state_territory="NY", state_territory="NY",
zipcode="10002", zipcode="10002",
senior_official=so, senior_official=so,
submitter=you,
creator=self.user, creator=self.user,
status="started", status="started",
) )
@ -2086,7 +2081,6 @@ class DomainRequestTests(TestWithUser, WebTest):
state_territory="NY", state_territory="NY",
zipcode="10002", zipcode="10002",
senior_official=so, senior_official=so,
submitter=you,
creator=self.user, creator=self.user,
status="started", status="started",
) )
@ -2297,7 +2291,6 @@ class DomainRequestTests(TestWithUser, WebTest):
address_line1="address 1", address_line1="address 1",
state_territory="NY", state_territory="NY",
zipcode="10002", zipcode="10002",
submitter=you,
creator=self.user, creator=self.user,
status="started", status="started",
) )
@ -2363,7 +2356,6 @@ class DomainRequestTests(TestWithUser, WebTest):
address_line1="address 1", address_line1="address 1",
state_territory="NY", state_territory="NY",
zipcode="10002", zipcode="10002",
submitter=submitter,
creator=self.user, creator=self.user,
status="started", status="started",
) )
@ -2729,7 +2721,6 @@ class DomainRequestTests(TestWithUser, WebTest):
zipcode="10002", zipcode="10002",
senior_official=so, senior_official=so,
requested_domain=domain, requested_domain=domain,
submitter=you,
creator=self.user, creator=self.user,
) )
domain_request.other_contacts.add(other) domain_request.other_contacts.add(other)
@ -3072,7 +3063,6 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest):
requested_domain=site, requested_domain=site,
status=DomainRequest.DomainRequestStatus.WITHDRAWN, status=DomainRequest.DomainRequestStatus.WITHDRAWN,
senior_official=contact, senior_official=contact,
submitter=contact_user,
) )
domain_request.other_contacts.set([contact_2]) domain_request.other_contacts.set([contact_2])

View file

@ -81,12 +81,12 @@ class OrderableFieldsMixin:
Or for fields with multiple order_fields: Or for fields with multiple order_fields:
``` ```
def get_sortable_submitter(self, obj): def get_sortable_creator(self, obj):
return obj.submitter return obj.creator
# Allows column order sorting # Allows column order sorting
get_sortable_submitter.admin_order_field = ["submitter__first_name", "submitter__last_name"] get_sortable_creator.admin_order_field = ["creator__first_name", "creaotr__last_name"]
# Sets column's header # Sets column's header
get_sortable_submitter.short_description = "submitter" get_sortable_creator.short_description = "creator"
``` ```
Parameters: Parameters:
@ -114,8 +114,8 @@ class OrderableFieldsMixin:
Returns (example): Returns (example):
``` ```
def get_submitter(self, obj): def get_creator(self, obj):
return obj.submitter return obj.creator
``` ```
""" """
attr = getattr(obj, field) attr = getattr(obj, field)