unit tests

This commit is contained in:
zandercymatics 2024-10-25 10:37:55 -06:00
parent 738ff0f952
commit d44bcadafb
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
6 changed files with 237 additions and 39 deletions

View file

@ -11,7 +11,6 @@ from registrar.forms import domain_request_wizard as forms
from registrar.forms.utility.wizard_form_helper import request_step_list
from registrar.models import DomainRequest
from registrar.models.contact import Contact
from registrar.models.suborganization import Suborganization
from registrar.models.user import User
from registrar.views.utility import StepsHelper
from registrar.views.utility.permission_views import DomainRequestPermissionDeleteView
@ -601,14 +600,16 @@ class RequestingEntity(DomainRequestWizard):
sub_organization = cleaned_data.get("sub_organization")
requested_suborganization = cleaned_data.get("requested_suborganization")
# If no suborganization presently exists but the user filled out org information then create a suborg automatically.
# If no suborganization presently exists but the user filled out
# org information then create a suborg automatically.
if is_suborganization and (sub_organization or requested_suborganization):
# Cleanup the organization name field, as this isn't for suborganizations.
self.domain_request.organization_name = None
self.domain_request.sub_organization = sub_organization
else:
# If the user doesn't intend to create a suborg, simply don't make one and do some data cleanup
self.domain_request.organization_name = self.domain_request.portfolio.organization_name
if self.domain_request.portfolio:
self.domain_request.organization_name = self.domain_request.portfolio.organization_name
self.domain_request.sub_organization = None
self.domain_request.requested_suborganization = None