diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index 0b89a45a6..feb553bf7 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -145,7 +145,6 @@ class DomainApplicationTests(TestWithUser, WebTest): # ---- TYPE PAGE ---- type_form = type_page.form type_form["organization_type-organization_type"] = "federal" - # test next button and validate data self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) type_result = type_page.form.submit() @@ -161,6 +160,7 @@ class DomainApplicationTests(TestWithUser, WebTest): # ---- FEDERAL BRANCH PAGE ---- # Follow the redirect to the next form page self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + federal_page = type_result.follow() federal_form = federal_page.form federal_form["organization_federal-federal_type"] = "executive" diff --git a/src/registrar/views/application.py b/src/registrar/views/application.py index 390327b6d..256f4be40 100644 --- a/src/registrar/views/application.py +++ b/src/registrar/views/application.py @@ -67,7 +67,7 @@ class ApplicationWizard(TemplateView): URL_NAMESPACE = "application" # name for accessing /application//edit EDIT_URL_NAME = "edit-application" - + NEW_URL_NAME = "/register/" # We need to pass our human-readable step titles as context to the templates. TITLES = { Step.ORGANIZATION_TYPE: _("Type of organization"), @@ -144,6 +144,7 @@ class ApplicationWizard(TemplateView): self._application = DomainApplication.objects.create( creator=self.request.user, # type: ignore ) + self.storage["application_id"] = self._application.id return self._application @@ -195,7 +196,6 @@ class ApplicationWizard(TemplateView): def get(self, request, *args, **kwargs): """This method handles GET requests.""" - current_url = resolve(request.path_info).url_name # if user visited via an "edit" url, associate the id of the @@ -213,12 +213,15 @@ class ApplicationWizard(TemplateView): # send users "to the application wizard" without needing to # know which view is first in the list of steps. if self.__class__ == ApplicationWizard: + # if starting a new application, clear the storage + if request.path_info == self.NEW_URL_NAME: + del self.storage + return self.goto(self.steps.first) self.steps.current = current_url context = self.get_context_data() context["forms"] = self.get_forms() - return render(request, self.template_name, context) def get_all_forms(self, **kwargs) -> list: @@ -242,7 +245,6 @@ class ApplicationWizard(TemplateView): and from the database if `use_db` is True (provided that record exists). An empty form will be provided if neither of those are true. """ - kwargs = { "files": files, "prefix": self.steps.current,