diff --git a/itou/www/job_seekers_views/urls.py b/itou/www/job_seekers_views/urls.py index 4c37869d325..30d6f506bb6 100644 --- a/itou/www/job_seekers_views/urls.py +++ b/itou/www/job_seekers_views/urls.py @@ -72,6 +72,31 @@ name="create_job_seeker_step_end_for_hire", kwargs={"hire_process": True}, ), + # TODO(ewen): deprecated URLs + path( + "/hire/update//1", + views.DeprecatedUpdateJobSeekerStep1View.as_view(), + name="update_job_seeker_step_1_for_hire", + kwargs={"hire_process": True}, + ), + path( + "/hire/update//2", + views.DeprecatedUpdateJobSeekerStep2View.as_view(), + name="update_job_seeker_step_2_for_hire", + kwargs={"hire_process": True}, + ), + path( + "/hire/update//3", + views.DeprecatedUpdateJobSeekerStep3View.as_view(), + name="update_job_seeker_step_3_for_hire", + kwargs={"hire_process": True}, + ), + path( + "/hire/update//end", + views.DeprecatedUpdateJobSeekerStepEndView.as_view(), + name="update_job_seeker_step_end_for_hire", + kwargs={"hire_process": True}, + ), path( "/hire//check-infos", views.CheckJobSeekerInformationsForHire.as_view(), @@ -110,6 +135,27 @@ views.UpdateJobSeekerStepEndView.as_view(), name="update_job_seeker_step_end", ), + # TODO(ewen): deprecated URLs + path( + "/update//1", + views.DeprecatedUpdateJobSeekerStep1View.as_view(), + name="update_job_seeker_step_1", + ), + path( + "/update//2", + views.DeprecatedUpdateJobSeekerStep2View.as_view(), + name="update_job_seeker_step_2", + ), + path( + "/update//3", + views.DeprecatedUpdateJobSeekerStep3View.as_view(), + name="update_job_seeker_step_3", + ), + path( + "/update//end", + views.DeprecatedUpdateJobSeekerStepEndView.as_view(), + name="update_job_seeker_step_end", + ), # Common path( "/create//check-infos", diff --git a/itou/www/job_seekers_views/views.py b/itou/www/job_seekers_views/views.py index 41457ec08b3..e953223e4f6 100644 --- a/itou/www/job_seekers_views/views.py +++ b/itou/www/job_seekers_views/views.py @@ -26,9 +26,9 @@ from itou.utils.apis.exceptions import AddressLookupError from itou.utils.emails import redact_email_address from itou.utils.pagination import ItouPaginator -from itou.utils.session import SessionNamespace +from itou.utils.session import SessionNamespace, SessionNamespaceRequiredMixin from itou.utils.urls import get_safe_url -from itou.www.apply.views.submit_views import ApplicationBaseView +from itou.www.apply.views.submit_views import ApplicationBaseView, ApplyStepBaseView from .forms import ( CheckJobSeekerInfoForm, @@ -1091,6 +1091,305 @@ def get_context_data(self, **kwargs): return super().get_context_data(**kwargs) | {"profile": self.profile, "progress": "80"} +class DeprecatedUpdateJobSeekerBaseView(SessionNamespaceRequiredMixin, ApplyStepBaseView): + def __init__(self): + super().__init__() + self.job_seeker_session = None + + def get_job_seeker_queryset(self): + return User.objects.filter(kind=UserKind.JOB_SEEKER) + + def setup(self, request, *args, **kwargs): + self.job_seeker = get_object_or_404(self.get_job_seeker_queryset(), public_id=kwargs["job_seeker_public_id"]) + self.job_seeker_session = SessionNamespace(request.session, f"job_seeker-{self.job_seeker.public_id}") + if request.user.is_authenticated and ( + request.user.is_job_seeker or not request.user.can_view_personal_information(self.job_seeker) + ): + # Since the link leading to this process isn't visible to those users, this should never happen + raise PermissionDenied("Votre utilisateur n'est pas autorisé à vérifier les informations de ce candidat") + super().setup(request, *args, **kwargs) + + def get_context_data(self, **kwargs): + return super().get_context_data(**kwargs) | { + "update_job_seeker": True, + "job_seeker": self.job_seeker, + "step_3_url": reverse( + "job_seekers_views:update_job_seeker_step_3_for_hire" + if self.hire_process + else "job_seekers_views:update_job_seeker_step_3", + kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id}, + ), + "reset_url": reverse( + "apply:application_jobs", + kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id}, + ), + "readonly_form": False, + } + + def _disable_form(self): + for field in self.form: + field.field.disabled = True + + def get_back_url(self): + view_name = self.previous_hire_url if self.hire_process else self.previous_apply_url + return reverse( + view_name, + kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id}, + ) + + def get_next_url(self): + view_name = self.next_hire_url if self.hire_process else self.next_apply_url + return reverse( + view_name, + kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id}, + ) + + +class DeprecatedUpdateJobSeekerStep1View(DeprecatedUpdateJobSeekerBaseView): + template_name = "job_seekers_views/create_or_update_job_seeker/step_1.html" + + previous_apply_url = "apply:application_jobs" + previous_hire_url = "job_seekers_views:check_job_seeker_info_for_hire" + next_apply_url = "job_seekers_views:update_job_seeker_step_2" + next_hire_url = "job_seekers_views:update_job_seeker_step_2_for_hire" + + def __init__(self): + super().__init__() + self.form = None + + def get_job_seeker_queryset(self): + return super().get_job_seeker_queryset().select_related("jobseeker_profile") + + def setup(self, request, *args, **kwargs): + super().setup(request, *args, **kwargs) + if not request.user.is_authenticated: + # Do nothing, LoginRequiredMixin will raise in dispatch() + return + if not self.job_seeker_session.exists(): + self.job_seeker_session.init({"user": {}}) + session_nir = self.job_seeker_session.get("profile", {}).get("nir") + session_lack_of_nir_reason = self.job_seeker_session.get("profile", {}).get("lack_of_nir_reason") + + self.form = CreateOrUpdateJobSeekerStep1Form( + instance=self.job_seeker, + initial=self.job_seeker_session.get("user", {}) + | { + "nir": session_nir if session_nir is not None else self.job_seeker.jobseeker_profile.nir, + "lack_of_nir_reason": ( + session_lack_of_nir_reason + if session_lack_of_nir_reason is not None + else self.job_seeker.jobseeker_profile.lack_of_nir_reason + ), + }, + data=request.POST or None, + ) + if not self.request.user.can_edit_personal_information(self.job_seeker): + self._disable_form() + + def post(self, request, *args, **kwargs): + if not self.request.user.can_edit_personal_information(self.job_seeker): + return HttpResponseRedirect(self.get_next_url()) + if self.form.is_valid(): + self.job_seeker_session.set( + "user", + self.job_seeker_session.get("user", {}) | self.form.cleaned_data_without_profile_fields, + ) + self.job_seeker_session.set( + "profile", + self.job_seeker_session.get("profile", {}) | self.form.cleaned_data_from_profile_fields, + ) + return HttpResponseRedirect(self.get_next_url()) + + return self.render_to_response(self.get_context_data(**kwargs)) + + def get_context_data(self, **kwargs): + return super().get_context_data(**kwargs) | { + "confirmation_needed": False, + "form": self.form, + "matomo_form_name": "apply-update-job-seeker-identity", + "readonly_form": not self.request.user.can_edit_personal_information(self.job_seeker), + "progress": "20", + } + + +class DeprecatedUpdateJobSeekerStep2View(DeprecatedUpdateJobSeekerBaseView): + template_name = "job_seekers_views/create_or_update_job_seeker/step_2.html" + required_session_namespaces = [ + "job_seeker_session" + ] + DeprecatedUpdateJobSeekerBaseView.required_session_namespaces + + previous_apply_url = "job_seekers_views:update_job_seeker_step_1" + previous_hire_url = "job_seekers_views:update_job_seeker_step_1_for_hire" + next_apply_url = "job_seekers_views:update_job_seeker_step_3" + next_hire_url = "job_seekers_views:update_job_seeker_step_3_for_hire" + + def __init__(self): + super().__init__() + self.form = None + + def setup(self, request, *args, **kwargs): + super().setup(request, *args, **kwargs) + self.form = CreateOrUpdateJobSeekerStep2Form( + instance=self.job_seeker, + initial=self.job_seeker_session.get("user", {}), + data=request.POST or None, + ) + if not self.request.user.can_edit_personal_information(self.job_seeker): + self._disable_form() + + def post(self, request, *args, **kwargs): + if not self.request.user.can_edit_personal_information(self.job_seeker): + return HttpResponseRedirect(self.get_next_url()) + if self.form.is_valid(): + self.job_seeker_session.set("user", self.job_seeker_session.get("user") | self.form.cleaned_data) + return HttpResponseRedirect(self.get_next_url()) + + return self.render_to_response(self.get_context_data(**kwargs)) + + def get_context_data(self, **kwargs): + return super().get_context_data(**kwargs) | { + "form": self.form, + "readonly_form": not self.request.user.can_edit_personal_information(self.job_seeker), + "progress": "40", + } + + +class DeprecatedUpdateJobSeekerStep3View(DeprecatedUpdateJobSeekerBaseView): + template_name = "job_seekers_views/create_or_update_job_seeker/step_3.html" + required_session_namespaces = [ + "job_seeker_session" + ] + DeprecatedUpdateJobSeekerBaseView.required_session_namespaces + + previous_apply_url = "job_seekers_views:update_job_seeker_step_2" + previous_hire_url = "job_seekers_views:update_job_seeker_step_2_for_hire" + next_apply_url = "job_seekers_views:update_job_seeker_step_end" + next_hire_url = "job_seekers_views:update_job_seeker_step_end_for_hire" + + def __init__(self): + super().__init__() + self.form = None + + def get_job_seeker_queryset(self): + return super().get_job_seeker_queryset().select_related("jobseeker_profile") + + def setup(self, request, *args, **kwargs): + super().setup(request, *args, **kwargs) + + self.form = CreateOrUpdateJobSeekerStep3Form( + instance=self.job_seeker.jobseeker_profile if self.job_seeker.has_jobseeker_profile else None, + initial=self.job_seeker_session.get("profile", {}), + data=request.POST or None, + ) + + def post(self, request, *args, **kwargs): + if self.form.is_valid(): + self.job_seeker_session.set("profile", self.job_seeker_session.get("profile", {}) | self.form.cleaned_data) + return HttpResponseRedirect(self.get_next_url()) + + return self.render_to_response(self.get_context_data(**kwargs)) + + def get_context_data(self, **kwargs): + return super().get_context_data(**kwargs) | { + "form": self.form, + "progress": "60", + } + + +class DeprecatedUpdateJobSeekerStepEndView(DeprecatedUpdateJobSeekerBaseView): + template_name = "job_seekers_views/create_or_update_job_seeker/step_end.html" + required_session_namespaces = [ + "job_seeker_session" + ] + DeprecatedUpdateJobSeekerBaseView.required_session_namespaces + + previous_apply_url = "job_seekers_views:update_job_seeker_step_3" + previous_hire_url = "job_seekers_views:update_job_seeker_step_3_for_hire" + next_apply_url = "apply:application_jobs" + next_hire_url = "job_seekers_views:check_job_seeker_info_for_hire" + + def __init__(self): + super().__init__() + self.profile = None + self.updated_user_fields = [] + + def _get_profile_data_from_session(self): + fields_to_exclude = [ + # Dummy fields used by CreateOrUpdateJobSeekerStep3Form() + "pole_emploi", + "pole_emploi_id_forgotten", + "rsa_allocation", + "unemployed", + "ass_allocation", + "aah_allocation", + "lack_of_nir", + # ForeignKeys - the session value will be the ID serialization and not the instance + "birth_place", + "birth_country", + ] + + birth_data = { + "birth_place_id": self.job_seeker_session.get("profile", {}).get("birth_place"), + "birth_country_id": self.job_seeker_session.get("profile", {}).get("birth_country"), + } + + return birth_data | { + k: v for k, v in self.job_seeker_session.get("profile", {}).items() if k not in fields_to_exclude + } + + def setup(self, request, *args, **kwargs): + super().setup(request, *args, **kwargs) + + allowed_user_fields_to_update = [] + if self.request.user.can_edit_personal_information(self.job_seeker): + allowed_user_fields_to_update.extend(CreateOrUpdateJobSeekerStep1Form.Meta.fields) + allowed_user_fields_to_update.extend(CreateOrUpdateJobSeekerStep2Form.Meta.fields) + + for field in allowed_user_fields_to_update: + if field in self.job_seeker_session.get("user", {}): + session_value = self.job_seeker_session.get("user")[field] + if session_value != getattr(self.job_seeker, field): + setattr(self.job_seeker, field, session_value) + self.updated_user_fields.append(field) + + if not self.job_seeker.has_jobseeker_profile: + self.profile = JobSeekerProfile( + user=self.job_seeker, + **self._get_profile_data_from_session(), + ) + else: + self.profile = self.job_seeker.jobseeker_profile + for k, v in self._get_profile_data_from_session().items(): + setattr(self.profile, k, v) + + @transaction.atomic + def post(self, request, *args, **kwargs): + self.updated_user_fields.append("last_checked_at") + try: + if "address_line_1" in self.updated_user_fields or "post_code" in self.updated_user_fields: + try: + self.job_seeker.geocode_address() + except AddressLookupError: + # Nothing to do: re-raised and already logged as error + pass + else: + self.updated_user_fields.extend(["coords", "geocoding_score"]) + self.job_seeker.last_checked_at = timezone.now() + self.job_seeker.save(update_fields=self.updated_user_fields) + except ValidationError as e: + messages.error(request, " ".join(e.messages)) + url = reverse( + "job_seekers_views:update_job_seeker_step_1", + kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id}, + ) + else: + self.profile.save() + self.job_seeker_session.delete() + url = self.get_next_url() + return HttpResponseRedirect(url) + + def get_context_data(self, **kwargs): + return super().get_context_data(**kwargs) | {"profile": self.profile, "progress": "80"} + + class CheckJobSeekerInformations(ApplicationBaseView): """ Ensure the job seeker has all required info. diff --git a/tests/www/apply/__snapshots__/test_submit.ambr b/tests/www/apply/__snapshots__/test_submit.ambr index d739cf49b6f..a93341f06b4 100644 --- a/tests/www/apply/__snapshots__/test_submit.ambr +++ b/tests/www/apply/__snapshots__/test_submit.ambr @@ -2103,9 +2103,9 @@ ]), }) # --- -# name: TestUpdateJobSeeker.test_as_company_with_proxied_job_seeker[queries - start] +# name: TestUpdateJobSeeker.test_as_authorized_prescriber_with_proxied_job_seeker_deprecated[queries - step 2] dict({ - 'num_queries': 11, + 'num_queries': 8, 'queries': list([ dict({ 'origin': list([ @@ -2168,103 +2168,51 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "companies_companymembership"."id", - "companies_companymembership"."user_id", - "companies_companymembership"."joined_at", - "companies_companymembership"."is_admin", - "companies_companymembership"."is_active", - "companies_companymembership"."created_at", - "companies_companymembership"."updated_at", - "companies_companymembership"."company_id", - "companies_companymembership"."updated_by_id", - "companies_companymembership"."notifications" - FROM "companies_companymembership" - WHERE ("companies_companymembership"."user_id" = %s - AND "companies_companymembership"."is_active") - ORDER BY "companies_companymembership"."created_at" ASC - ''', - }), - dict({ - 'origin': list([ - 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', - ]), - 'sql': ''' - SELECT "companies_company"."id", - "companies_company"."address_line_1", - "companies_company"."address_line_2", - "companies_company"."post_code", - "companies_company"."city", - "companies_company"."department", - "companies_company"."coords", - "companies_company"."geocoding_score", - "companies_company"."geocoding_updated_at", - "companies_company"."ban_api_resolved_address", - "companies_company"."insee_city_id", - "companies_company"."name", - "companies_company"."created_at", - "companies_company"."updated_at", - "companies_company"."uid", - "companies_company"."active_members_email_reminder_last_sent_at", - "companies_company"."automatic_geocoding_update", - "companies_company"."siret", - "companies_company"."naf", - "companies_company"."kind", - "companies_company"."brand", - "companies_company"."phone", - "companies_company"."email", - "companies_company"."auth_email", - "companies_company"."website", - "companies_company"."description", - "companies_company"."provided_support", - "companies_company"."source", - "companies_company"."created_by_id", - "companies_company"."block_job_applications", - "companies_company"."job_applications_blocked_at", - "companies_company"."convention_id", - "companies_company"."job_app_score", - "companies_company"."is_searchable", - "companies_company"."rdv_solidarites_id", - EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1) AS "has_convention_in_grace_period", - "companies_siaeconvention"."id", - "companies_siaeconvention"."kind", - "companies_siaeconvention"."siret_signature", - "companies_siaeconvention"."is_active", - "companies_siaeconvention"."deactivated_at", - "companies_siaeconvention"."reactivated_by_id", - "companies_siaeconvention"."reactivated_at", - "companies_siaeconvention"."asp_id", - "companies_siaeconvention"."created_at", - "companies_siaeconvention"."updated_at" - FROM "companies_company" - INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") - LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") - WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_companymembership"."user_id" = %s - AND "companies_company"."id" IN (%s) - AND (NOT ("companies_company"."kind" IN (%s, - %s, - %s, - %s, - %s)) - OR "companies_company"."source" = %s - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."id" = ("companies_company"."convention_id") - AND U0."is_active") - LIMIT 1) - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1))) - ORDER BY RANDOM() ASC + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC ''', }), dict({ @@ -2275,7 +2223,8 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -2318,7 +2267,30 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") + LIMIT 1 + ''', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep2View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -2374,38 +2346,12 @@ ]), 'sql': 'RELEASE SAVEPOINT ""', }), - dict({ - 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'Session.save[/django/db/models/base.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - UPDATE "django_session" - SET "session_data" = %s, - "expire_date" = %s - WHERE "django_session"."session_key" = %s - ''', - }), - dict({ - 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), ]), }) # --- -# name: TestUpdateJobSeeker.test_as_company_with_proxied_job_seeker[queries - step 1] +# name: TestUpdateJobSeeker.test_as_authorized_prescriber_with_proxied_job_seeker_deprecated[queries - step 3] dict({ - 'num_queries': 14, + 'num_queries': 8, 'queries': list([ dict({ 'origin': list([ @@ -2421,20 +2367,6 @@ LIMIT 21 ''', }), - dict({ - 'origin': list([ - 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - SELECT "django_session"."session_key", - "django_session"."session_data", - "django_session"."expire_date" - FROM "django_session" - WHERE ("django_session"."expire_date" > %s - AND "django_session"."session_key" = %s) - LIMIT 21 - ''', - }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -2482,56 +2414,197 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "companies_companymembership"."id", - "companies_companymembership"."user_id", - "companies_companymembership"."joined_at", - "companies_companymembership"."is_admin", - "companies_companymembership"."is_active", - "companies_companymembership"."created_at", - "companies_companymembership"."updated_at", - "companies_companymembership"."company_id", - "companies_companymembership"."updated_by_id", - "companies_companymembership"."notifications" - FROM "companies_companymembership" - WHERE ("companies_companymembership"."user_id" = %s - AND "companies_companymembership"."is_active") - ORDER BY "companies_companymembership"."created_at" ASC - ''', - }), - dict({ - 'origin': list([ - 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', - ]), - 'sql': ''' - SELECT "companies_company"."id", - "companies_company"."address_line_1", - "companies_company"."address_line_2", - "companies_company"."post_code", - "companies_company"."city", - "companies_company"."department", - "companies_company"."coords", - "companies_company"."geocoding_score", - "companies_company"."geocoding_updated_at", - "companies_company"."ban_api_resolved_address", - "companies_company"."insee_city_id", - "companies_company"."name", - "companies_company"."created_at", - "companies_company"."updated_at", - "companies_company"."uid", - "companies_company"."active_members_email_reminder_last_sent_at", - "companies_company"."automatic_geocoding_update", - "companies_company"."siret", - "companies_company"."naf", - "companies_company"."kind", - "companies_company"."brand", - "companies_company"."phone", - "companies_company"."email", - "companies_company"."auth_email", - "companies_company"."website", - "companies_company"."description", - "companies_company"."provided_support", - "companies_company"."source", - "companies_company"."created_by_id", + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login", + "users_jobseekerprofile"."user_id", + "users_jobseekerprofile"."birthdate", + "users_jobseekerprofile"."birth_place_id", + "users_jobseekerprofile"."birth_country_id", + "users_jobseekerprofile"."nir", + "users_jobseekerprofile"."lack_of_nir_reason", + "users_jobseekerprofile"."pole_emploi_id", + "users_jobseekerprofile"."lack_of_pole_emploi_id_reason", + "users_jobseekerprofile"."asp_uid", + "users_jobseekerprofile"."education_level", + "users_jobseekerprofile"."resourceless", + "users_jobseekerprofile"."rqth_employee", + "users_jobseekerprofile"."oeth_employee", + "users_jobseekerprofile"."pole_emploi_since", + "users_jobseekerprofile"."unemployed_since", + "users_jobseekerprofile"."has_rsa_allocation", + "users_jobseekerprofile"."rsa_allocation_since", + "users_jobseekerprofile"."ass_allocation_since", + "users_jobseekerprofile"."aah_allocation_since", + "users_jobseekerprofile"."are_allocation_since", + "users_jobseekerprofile"."activity_bonus_since", + "users_jobseekerprofile"."cape_freelance", + "users_jobseekerprofile"."cesa_freelance", + "users_jobseekerprofile"."actor_met_for_business_creation", + "users_jobseekerprofile"."mean_monthly_income_before_process", + "users_jobseekerprofile"."eiti_contributions", + "users_jobseekerprofile"."hexa_lane_number", + "users_jobseekerprofile"."hexa_std_extension", + "users_jobseekerprofile"."hexa_non_std_extension", + "users_jobseekerprofile"."hexa_lane_type", + "users_jobseekerprofile"."hexa_lane_name", + "users_jobseekerprofile"."hexa_additional_address", + "users_jobseekerprofile"."hexa_post_code", + "users_jobseekerprofile"."hexa_commune_id", + "users_jobseekerprofile"."pe_obfuscated_nir", + "users_jobseekerprofile"."pe_last_certification_attempt_at" + FROM "users_user" + LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") + WHERE ("users_user"."kind" = %s + AND "users_user"."public_id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") + LIMIT 1 + ''', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep3View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", "companies_company"."block_job_applications", "companies_company"."job_applications_blocked_at", "companies_company"."convention_id", @@ -2540,58 +2613,3403 @@ "companies_company"."rdv_solidarites_id", EXISTS (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1) AS "has_convention_in_grace_period", - "companies_siaeconvention"."id", - "companies_siaeconvention"."kind", - "companies_siaeconvention"."siret_signature", - "companies_siaeconvention"."is_active", - "companies_siaeconvention"."deactivated_at", - "companies_siaeconvention"."reactivated_by_id", - "companies_siaeconvention"."reactivated_at", - "companies_siaeconvention"."asp_id", - "companies_siaeconvention"."created_at", - "companies_siaeconvention"."updated_at" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" FROM "companies_company" - INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") - LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_companymembership"."user_id" = %s - AND "companies_company"."id" IN (%s) - AND (NOT ("companies_company"."kind" IN (%s, - %s, - %s, - %s, - %s)) - OR "companies_company"."source" = %s - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."id" = ("companies_company"."convention_id") - AND U0."is_active") - LIMIT 1) - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1))) - ORDER BY RANDOM() ASC + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_company_with_proxied_job_seeker[queries - start] + dict({ + 'num_queries': 11, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."public_id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Session.save[/django/db/models/base.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + UPDATE "django_session" + SET "session_data" = %s, + "expire_date" = %s + WHERE "django_session"."session_key" = %s + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_company_with_proxied_job_seeker[queries - step 1] + dict({ + 'num_queries': 14, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login", + "users_jobseekerprofile"."user_id", + "users_jobseekerprofile"."birthdate", + "users_jobseekerprofile"."birth_place_id", + "users_jobseekerprofile"."birth_country_id", + "users_jobseekerprofile"."nir", + "users_jobseekerprofile"."lack_of_nir_reason", + "users_jobseekerprofile"."pole_emploi_id", + "users_jobseekerprofile"."lack_of_pole_emploi_id_reason", + "users_jobseekerprofile"."asp_uid", + "users_jobseekerprofile"."education_level", + "users_jobseekerprofile"."resourceless", + "users_jobseekerprofile"."rqth_employee", + "users_jobseekerprofile"."oeth_employee", + "users_jobseekerprofile"."pole_emploi_since", + "users_jobseekerprofile"."unemployed_since", + "users_jobseekerprofile"."has_rsa_allocation", + "users_jobseekerprofile"."rsa_allocation_since", + "users_jobseekerprofile"."ass_allocation_since", + "users_jobseekerprofile"."aah_allocation_since", + "users_jobseekerprofile"."are_allocation_since", + "users_jobseekerprofile"."activity_bonus_since", + "users_jobseekerprofile"."cape_freelance", + "users_jobseekerprofile"."cesa_freelance", + "users_jobseekerprofile"."actor_met_for_business_creation", + "users_jobseekerprofile"."mean_monthly_income_before_process", + "users_jobseekerprofile"."eiti_contributions", + "users_jobseekerprofile"."hexa_lane_number", + "users_jobseekerprofile"."hexa_std_extension", + "users_jobseekerprofile"."hexa_non_std_extension", + "users_jobseekerprofile"."hexa_lane_type", + "users_jobseekerprofile"."hexa_lane_name", + "users_jobseekerprofile"."hexa_additional_address", + "users_jobseekerprofile"."hexa_post_code", + "users_jobseekerprofile"."hexa_commune_id", + "users_jobseekerprofile"."pe_obfuscated_nir", + "users_jobseekerprofile"."pe_last_certification_attempt_at" + FROM "users_user" + LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") + WHERE ("users_user"."kind" = %s + AND "users_user"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', + }), + dict({ + 'origin': list([ + 'CustomFieldRenderer.render[utils/custom_renderer.py]', + 'SimpleNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'IfNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'BlockNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'BlockNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + ]), + 'sql': ''' + SELECT "asp_country"."id", + "asp_country"."code", + "asp_country"."name", + "asp_country"."group", + "asp_country"."department" + FROM "asp_country" + ORDER BY "asp_country"."name" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Session.save[/django/db/models/base.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + UPDATE "django_session" + SET "session_data" = %s, + "expire_date" = %s + WHERE "django_session"."session_key" = %s + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_company_with_proxied_job_seeker[queries - step 2] + dict({ + 'num_queries': 10, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_2.html]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_company_with_proxied_job_seeker[queries - step 3] + dict({ + 'num_queries': 10, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login", + "users_jobseekerprofile"."user_id", + "users_jobseekerprofile"."birthdate", + "users_jobseekerprofile"."birth_place_id", + "users_jobseekerprofile"."birth_country_id", + "users_jobseekerprofile"."nir", + "users_jobseekerprofile"."lack_of_nir_reason", + "users_jobseekerprofile"."pole_emploi_id", + "users_jobseekerprofile"."lack_of_pole_emploi_id_reason", + "users_jobseekerprofile"."asp_uid", + "users_jobseekerprofile"."education_level", + "users_jobseekerprofile"."resourceless", + "users_jobseekerprofile"."rqth_employee", + "users_jobseekerprofile"."oeth_employee", + "users_jobseekerprofile"."pole_emploi_since", + "users_jobseekerprofile"."unemployed_since", + "users_jobseekerprofile"."has_rsa_allocation", + "users_jobseekerprofile"."rsa_allocation_since", + "users_jobseekerprofile"."ass_allocation_since", + "users_jobseekerprofile"."aah_allocation_since", + "users_jobseekerprofile"."are_allocation_since", + "users_jobseekerprofile"."activity_bonus_since", + "users_jobseekerprofile"."cape_freelance", + "users_jobseekerprofile"."cesa_freelance", + "users_jobseekerprofile"."actor_met_for_business_creation", + "users_jobseekerprofile"."mean_monthly_income_before_process", + "users_jobseekerprofile"."eiti_contributions", + "users_jobseekerprofile"."hexa_lane_number", + "users_jobseekerprofile"."hexa_std_extension", + "users_jobseekerprofile"."hexa_non_std_extension", + "users_jobseekerprofile"."hexa_lane_type", + "users_jobseekerprofile"."hexa_lane_name", + "users_jobseekerprofile"."hexa_additional_address", + "users_jobseekerprofile"."hexa_post_code", + "users_jobseekerprofile"."hexa_commune_id", + "users_jobseekerprofile"."pe_obfuscated_nir", + "users_jobseekerprofile"."pe_last_certification_attempt_at" + FROM "users_user" + LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") + WHERE ("users_user"."kind" = %s + AND "users_user"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_3.html]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_company_with_proxied_job_seeker_deprecated[queries - step 2] + dict({ + 'num_queries': 9, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."public_id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep2View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_2.html]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_company_with_proxied_job_seeker_deprecated[queries - step 3] + dict({ + 'num_queries': 9, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login", + "users_jobseekerprofile"."user_id", + "users_jobseekerprofile"."birthdate", + "users_jobseekerprofile"."birth_place_id", + "users_jobseekerprofile"."birth_country_id", + "users_jobseekerprofile"."nir", + "users_jobseekerprofile"."lack_of_nir_reason", + "users_jobseekerprofile"."pole_emploi_id", + "users_jobseekerprofile"."lack_of_pole_emploi_id_reason", + "users_jobseekerprofile"."asp_uid", + "users_jobseekerprofile"."education_level", + "users_jobseekerprofile"."resourceless", + "users_jobseekerprofile"."rqth_employee", + "users_jobseekerprofile"."oeth_employee", + "users_jobseekerprofile"."pole_emploi_since", + "users_jobseekerprofile"."unemployed_since", + "users_jobseekerprofile"."has_rsa_allocation", + "users_jobseekerprofile"."rsa_allocation_since", + "users_jobseekerprofile"."ass_allocation_since", + "users_jobseekerprofile"."aah_allocation_since", + "users_jobseekerprofile"."are_allocation_since", + "users_jobseekerprofile"."activity_bonus_since", + "users_jobseekerprofile"."cape_freelance", + "users_jobseekerprofile"."cesa_freelance", + "users_jobseekerprofile"."actor_met_for_business_creation", + "users_jobseekerprofile"."mean_monthly_income_before_process", + "users_jobseekerprofile"."eiti_contributions", + "users_jobseekerprofile"."hexa_lane_number", + "users_jobseekerprofile"."hexa_std_extension", + "users_jobseekerprofile"."hexa_non_std_extension", + "users_jobseekerprofile"."hexa_lane_type", + "users_jobseekerprofile"."hexa_lane_name", + "users_jobseekerprofile"."hexa_additional_address", + "users_jobseekerprofile"."hexa_post_code", + "users_jobseekerprofile"."hexa_commune_id", + "users_jobseekerprofile"."pe_obfuscated_nir", + "users_jobseekerprofile"."pe_last_certification_attempt_at" + FROM "users_user" + LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") + WHERE ("users_user"."kind" = %s + AND "users_user"."public_id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep3View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_3.html]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - start] + dict({ + 'num_queries': 11, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."public_id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") + LIMIT 1 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Session.save[/django/db/models/base.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + UPDATE "django_session" + SET "session_data" = %s, + "expire_date" = %s + WHERE "django_session"."session_key" = %s + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 1] + dict({ + 'num_queries': 13, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login", + "users_jobseekerprofile"."user_id", + "users_jobseekerprofile"."birthdate", + "users_jobseekerprofile"."birth_place_id", + "users_jobseekerprofile"."birth_country_id", + "users_jobseekerprofile"."nir", + "users_jobseekerprofile"."lack_of_nir_reason", + "users_jobseekerprofile"."pole_emploi_id", + "users_jobseekerprofile"."lack_of_pole_emploi_id_reason", + "users_jobseekerprofile"."asp_uid", + "users_jobseekerprofile"."education_level", + "users_jobseekerprofile"."resourceless", + "users_jobseekerprofile"."rqth_employee", + "users_jobseekerprofile"."oeth_employee", + "users_jobseekerprofile"."pole_emploi_since", + "users_jobseekerprofile"."unemployed_since", + "users_jobseekerprofile"."has_rsa_allocation", + "users_jobseekerprofile"."rsa_allocation_since", + "users_jobseekerprofile"."ass_allocation_since", + "users_jobseekerprofile"."aah_allocation_since", + "users_jobseekerprofile"."are_allocation_since", + "users_jobseekerprofile"."activity_bonus_since", + "users_jobseekerprofile"."cape_freelance", + "users_jobseekerprofile"."cesa_freelance", + "users_jobseekerprofile"."actor_met_for_business_creation", + "users_jobseekerprofile"."mean_monthly_income_before_process", + "users_jobseekerprofile"."eiti_contributions", + "users_jobseekerprofile"."hexa_lane_number", + "users_jobseekerprofile"."hexa_std_extension", + "users_jobseekerprofile"."hexa_non_std_extension", + "users_jobseekerprofile"."hexa_lane_type", + "users_jobseekerprofile"."hexa_lane_name", + "users_jobseekerprofile"."hexa_additional_address", + "users_jobseekerprofile"."hexa_post_code", + "users_jobseekerprofile"."hexa_commune_id", + "users_jobseekerprofile"."pe_obfuscated_nir", + "users_jobseekerprofile"."pe_last_certification_attempt_at" + FROM "users_user" + LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") + WHERE ("users_user"."kind" = %s + AND "users_user"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") + LIMIT 1 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'CustomFieldRenderer.render[utils/custom_renderer.py]', + 'SimpleNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'IfNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'BlockNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'BlockNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + ]), + 'sql': ''' + SELECT "asp_country"."id", + "asp_country"."code", + "asp_country"."name", + "asp_country"."group", + "asp_country"."department" + FROM "asp_country" + ORDER BY "asp_country"."name" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Session.save[/django/db/models/base.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + UPDATE "django_session" + SET "session_data" = %s, + "expire_date" = %s + WHERE "django_session"."session_key" = %s + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 2] + dict({ + 'num_queries': 9, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") + LIMIT 1 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 3] + dict({ + 'num_queries': 9, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login", + "users_jobseekerprofile"."user_id", + "users_jobseekerprofile"."birthdate", + "users_jobseekerprofile"."birth_place_id", + "users_jobseekerprofile"."birth_country_id", + "users_jobseekerprofile"."nir", + "users_jobseekerprofile"."lack_of_nir_reason", + "users_jobseekerprofile"."pole_emploi_id", + "users_jobseekerprofile"."lack_of_pole_emploi_id_reason", + "users_jobseekerprofile"."asp_uid", + "users_jobseekerprofile"."education_level", + "users_jobseekerprofile"."resourceless", + "users_jobseekerprofile"."rqth_employee", + "users_jobseekerprofile"."oeth_employee", + "users_jobseekerprofile"."pole_emploi_since", + "users_jobseekerprofile"."unemployed_since", + "users_jobseekerprofile"."has_rsa_allocation", + "users_jobseekerprofile"."rsa_allocation_since", + "users_jobseekerprofile"."ass_allocation_since", + "users_jobseekerprofile"."aah_allocation_since", + "users_jobseekerprofile"."are_allocation_since", + "users_jobseekerprofile"."activity_bonus_since", + "users_jobseekerprofile"."cape_freelance", + "users_jobseekerprofile"."cesa_freelance", + "users_jobseekerprofile"."actor_met_for_business_creation", + "users_jobseekerprofile"."mean_monthly_income_before_process", + "users_jobseekerprofile"."eiti_contributions", + "users_jobseekerprofile"."hexa_lane_number", + "users_jobseekerprofile"."hexa_std_extension", + "users_jobseekerprofile"."hexa_non_std_extension", + "users_jobseekerprofile"."hexa_lane_type", + "users_jobseekerprofile"."hexa_lane_name", + "users_jobseekerprofile"."hexa_additional_address", + "users_jobseekerprofile"."hexa_post_code", + "users_jobseekerprofile"."hexa_commune_id", + "users_jobseekerprofile"."pe_obfuscated_nir", + "users_jobseekerprofile"."pe_last_certification_attempt_at" + FROM "users_user" + LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") + WHERE ("users_user"."kind" = %s + AND "users_user"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") + LIMIT 1 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_unauthorized_prescriber_that_created_proxied_job_seeker_deprecated[queries - step 2] + dict({ + 'num_queries': 8, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."public_id" = %s) + LIMIT 21 ''', }), dict({ 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), - 'sql': 'SAVEPOINT ""', + 'sql': ''' + SELECT %s AS "a" + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") + LIMIT 1 + ''', }), dict({ 'origin': list([ - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -2643,8 +6061,135 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + ]), + }) +# --- +# name: TestUpdateJobSeeker.test_as_unauthorized_prescriber_that_created_proxied_job_seeker_deprecated[queries - step 3] + dict({ + 'num_queries': 8, + 'queries': list([ + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -2718,96 +6263,97 @@ FROM "users_user" LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") WHERE ("users_user"."kind" = %s - AND "users_user"."id" = %s) + AND "users_user"."public_id" = %s) LIMIT 21 ''', }), dict({ 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'Company.has_admin[common_apps/organizations/models.py]', - 'Company.convention_can_be_accessed_by[companies/models.py]', - 'nav[utils/templatetags/nav.py]', - 'InclusionNode[layout/_header_authenticated.html]', - 'IncludeNode[layout/base.html]', - 'IfNode[layout/base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT %s AS "a" - FROM "users_user" - INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") - WHERE ("companies_companymembership"."id" IN - (SELECT U0."id" - FROM "companies_companymembership" U0 - INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") - WHERE (U0."company_id" = %s - AND U2."is_active" - AND U0."is_active" - AND U0."is_admin" - AND U2."is_active")) - AND "users_user"."id" = %s) - LIMIT 1 - ''', - }), - dict({ - 'origin': list([ - 'CustomFieldRenderer.render[utils/custom_renderer.py]', - 'SimpleNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - 'IfNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - 'BlockNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'BlockNode[layout/base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - ]), - 'sql': ''' - SELECT "asp_country"."id", - "asp_country"."code", - "asp_country"."name", - "asp_country"."group", - "asp_country"."department" - FROM "asp_country" - ORDER BY "asp_country"."name" ASC - ''', - }), - dict({ - 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'SAVEPOINT ""', + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") + LIMIT 1 + ''', }), dict({ 'origin': list([ - 'Session.save[/django/db/models/base.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' - UPDATE "django_session" - SET "session_data" = %s, - "expire_date" = %s - WHERE "django_session"."session_key" = %s + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 ''', }), dict({ 'origin': list([ 'Atomic.__exit__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', ]), 'sql': 'RELEASE SAVEPOINT ""', }), ]), }) # --- -# name: TestUpdateJobSeeker.test_as_company_with_proxied_job_seeker[queries - step 2] +# name: TestUpdateJobSeeker.test_with_job_seeker_without_nir[queries - start] dict({ - 'num_queries': 10, + 'num_queries': 11, 'queries': list([ dict({ 'origin': list([ @@ -2823,20 +6369,6 @@ LIMIT 21 ''', }), - dict({ - 'origin': list([ - 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - SELECT "django_session"."session_key", - "django_session"."session_data", - "django_session"."expire_date" - FROM "django_session" - WHERE ("django_session"."expire_date" > %s - AND "django_session"."session_key" = %s) - LIMIT 21 - ''', - }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -2991,9 +6523,50 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."public_id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -3045,88 +6618,42 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'Atomic.__exit__[/django/db/transaction.py]', ]), - 'sql': ''' - SELECT "users_user"."id", - "users_user"."password", - "users_user"."last_login", - "users_user"."is_superuser", - "users_user"."username", - "users_user"."first_name", - "users_user"."last_name", - "users_user"."is_staff", - "users_user"."is_active", - "users_user"."date_joined", - "users_user"."address_line_1", - "users_user"."address_line_2", - "users_user"."post_code", - "users_user"."city", - "users_user"."department", - "users_user"."coords", - "users_user"."geocoding_score", - "users_user"."geocoding_updated_at", - "users_user"."ban_api_resolved_address", - "users_user"."insee_city_id", - "users_user"."title", - "users_user"."email", - "users_user"."phone", - "users_user"."kind", - "users_user"."identity_provider", - "users_user"."has_completed_welcoming_tour", - "users_user"."created_by_id", - "users_user"."external_data_source_history", - "users_user"."last_checked_at", - "users_user"."public_id", - "users_user"."address_filled_at", - "users_user"."first_login" - FROM "users_user" - WHERE ("users_user"."kind" = %s - AND "users_user"."id" = %s) - LIMIT 21 - ''', + 'sql': 'RELEASE SAVEPOINT ""', }), dict({ 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', + 'Atomic.__enter__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', ]), - 'sql': 'RELEASE SAVEPOINT ""', + 'sql': 'SAVEPOINT ""', }), dict({ 'origin': list([ - 'Company.has_admin[common_apps/organizations/models.py]', - 'Company.convention_can_be_accessed_by[companies/models.py]', - 'nav[utils/templatetags/nav.py]', - 'InclusionNode[layout/_header_authenticated.html]', - 'IncludeNode[layout/base.html]', - 'IfNode[layout/base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_2.html]', + 'Session.save[/django/db/models/base.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', ]), 'sql': ''' - SELECT %s AS "a" - FROM "users_user" - INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") - WHERE ("companies_companymembership"."id" IN - (SELECT U0."id" - FROM "companies_companymembership" U0 - INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") - WHERE (U0."company_id" = %s - AND U2."is_active" - AND U0."is_active" - AND U0."is_admin" - AND U2."is_active")) - AND "users_user"."id" = %s) - LIMIT 1 + UPDATE "django_session" + SET "session_data" = %s, + "expire_date" = %s + WHERE "django_session"."session_key" = %s ''', }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), ]), }) # --- -# name: TestUpdateJobSeeker.test_as_company_with_proxied_job_seeker[queries - step 3] +# name: TestUpdateJobSeeker.test_with_job_seeker_without_nir[queries - step 1] dict({ - 'num_queries': 10, + 'num_queries': 14, 'queries': list([ dict({ 'origin': list([ @@ -3310,9 +6837,9 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -3364,8 +6891,8 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -3458,7 +6985,7 @@ 'IncludeNode[layout/base.html]', 'IfNode[layout/base.html]', 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_3.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', ]), 'sql': ''' SELECT %s AS "a" @@ -3477,12 +7004,58 @@ LIMIT 1 ''', }), + dict({ + 'origin': list([ + 'CustomFieldRenderer.render[utils/custom_renderer.py]', + 'SimpleNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'IfNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'BlockNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'BlockNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + ]), + 'sql': ''' + SELECT "asp_country"."id", + "asp_country"."code", + "asp_country"."name", + "asp_country"."group", + "asp_country"."department" + FROM "asp_country" + ORDER BY "asp_country"."name" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Session.save[/django/db/models/base.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + UPDATE "django_session" + SET "session_data" = %s, + "expire_date" = %s + WHERE "django_session"."session_key" = %s + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), ]), }) # --- -# name: TestUpdateJobSeeker.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - start] +# name: TestUpdateJobSeeker.test_with_job_seeker_without_nir[queries - step 2] dict({ - 'num_queries': 11, + 'num_queries': 10, 'queries': list([ dict({ 'origin': list([ @@ -3498,6 +7071,20 @@ LIMIT 21 ''', }), + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -3545,105 +7132,116 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "prescribers_prescribermembership"."id", - "prescribers_prescribermembership"."user_id", - "prescribers_prescribermembership"."joined_at", - "prescribers_prescribermembership"."is_admin", - "prescribers_prescribermembership"."is_active", - "prescribers_prescribermembership"."created_at", - "prescribers_prescribermembership"."updated_at", - "prescribers_prescribermembership"."organization_id", - "prescribers_prescribermembership"."updated_by_id", - "prescribers_prescriberorganization"."id", - "prescribers_prescriberorganization"."address_line_1", - "prescribers_prescriberorganization"."address_line_2", - "prescribers_prescriberorganization"."post_code", - "prescribers_prescriberorganization"."city", - "prescribers_prescriberorganization"."department", - "prescribers_prescriberorganization"."coords", - "prescribers_prescriberorganization"."geocoding_score", - "prescribers_prescriberorganization"."geocoding_updated_at", - "prescribers_prescriberorganization"."ban_api_resolved_address", - "prescribers_prescriberorganization"."insee_city_id", - "prescribers_prescriberorganization"."name", - "prescribers_prescriberorganization"."created_at", - "prescribers_prescriberorganization"."updated_at", - "prescribers_prescriberorganization"."uid", - "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", - "prescribers_prescriberorganization"."automatic_geocoding_update", - "prescribers_prescriberorganization"."siret", - "prescribers_prescriberorganization"."is_head_office", - "prescribers_prescriberorganization"."kind", - "prescribers_prescriberorganization"."is_brsa", - "prescribers_prescriberorganization"."phone", - "prescribers_prescriberorganization"."email", - "prescribers_prescriberorganization"."website", - "prescribers_prescriberorganization"."description", - "prescribers_prescriberorganization"."is_authorized", - "prescribers_prescriberorganization"."code_safir_pole_emploi", - "prescribers_prescriberorganization"."created_by_id", - "prescribers_prescriberorganization"."authorization_status", - "prescribers_prescriberorganization"."authorization_updated_at", - "prescribers_prescriberorganization"."authorization_updated_by_id" - FROM "prescribers_prescribermembership" - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active") - ORDER BY "prescribers_prescribermembership"."created_at" ASC + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC ''', }), dict({ 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), - 'sql': 'SAVEPOINT ""', + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC + ''', }), dict({ 'origin': list([ - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + 'Atomic.__enter__[/django/db/transaction.py]', ]), - 'sql': ''' - SELECT "users_user"."id", - "users_user"."password", - "users_user"."last_login", - "users_user"."is_superuser", - "users_user"."username", - "users_user"."first_name", - "users_user"."last_name", - "users_user"."is_staff", - "users_user"."is_active", - "users_user"."date_joined", - "users_user"."address_line_1", - "users_user"."address_line_2", - "users_user"."post_code", - "users_user"."city", - "users_user"."department", - "users_user"."coords", - "users_user"."geocoding_score", - "users_user"."geocoding_updated_at", - "users_user"."ban_api_resolved_address", - "users_user"."insee_city_id", - "users_user"."title", - "users_user"."email", - "users_user"."phone", - "users_user"."kind", - "users_user"."identity_provider", - "users_user"."has_completed_welcoming_tour", - "users_user"."created_by_id", - "users_user"."external_data_source_history", - "users_user"."last_checked_at", - "users_user"."public_id", - "users_user"."address_filled_at", - "users_user"."first_login" - FROM "users_user" - WHERE ("users_user"."kind" = %s - AND "users_user"."public_id" = %s) - LIMIT 21 - ''', + 'sql': 'SAVEPOINT ""', }), dict({ 'origin': list([ - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -3695,21 +7293,46 @@ }), dict({ 'origin': list([ - 'User.is_prescriber_with_authorized_org[users/models.py]', - 'User.can_edit_personal_information[users/models.py]', - 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' - SELECT %s AS "a" - FROM "prescribers_prescribermembership" - INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active" - AND "prescribers_prescriberorganization"."is_authorized" - AND "users_user"."is_active") - LIMIT 1 + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."id" = %s) + LIMIT 21 ''', }), dict({ @@ -3720,36 +7343,38 @@ }), dict({ 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'Session.save[/django/db/models/base.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_2.html]', ]), 'sql': ''' - UPDATE "django_session" - SET "session_data" = %s, - "expire_date" = %s - WHERE "django_session"."session_key" = %s + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 ''', }), - dict({ - 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), ]), }) # --- -# name: TestUpdateJobSeeker.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 1] +# name: TestUpdateJobSeeker.test_with_job_seeker_without_nir[queries - step 3] dict({ - 'num_queries': 13, + 'num_queries': 10, 'queries': list([ dict({ 'origin': list([ @@ -3826,51 +7451,103 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "prescribers_prescribermembership"."id", - "prescribers_prescribermembership"."user_id", - "prescribers_prescribermembership"."joined_at", - "prescribers_prescribermembership"."is_admin", - "prescribers_prescribermembership"."is_active", - "prescribers_prescribermembership"."created_at", - "prescribers_prescribermembership"."updated_at", - "prescribers_prescribermembership"."organization_id", - "prescribers_prescribermembership"."updated_by_id", - "prescribers_prescriberorganization"."id", - "prescribers_prescriberorganization"."address_line_1", - "prescribers_prescriberorganization"."address_line_2", - "prescribers_prescriberorganization"."post_code", - "prescribers_prescriberorganization"."city", - "prescribers_prescriberorganization"."department", - "prescribers_prescriberorganization"."coords", - "prescribers_prescriberorganization"."geocoding_score", - "prescribers_prescriberorganization"."geocoding_updated_at", - "prescribers_prescriberorganization"."ban_api_resolved_address", - "prescribers_prescriberorganization"."insee_city_id", - "prescribers_prescriberorganization"."name", - "prescribers_prescriberorganization"."created_at", - "prescribers_prescriberorganization"."updated_at", - "prescribers_prescriberorganization"."uid", - "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", - "prescribers_prescriberorganization"."automatic_geocoding_update", - "prescribers_prescriberorganization"."siret", - "prescribers_prescriberorganization"."is_head_office", - "prescribers_prescriberorganization"."kind", - "prescribers_prescriberorganization"."is_brsa", - "prescribers_prescriberorganization"."phone", - "prescribers_prescriberorganization"."email", - "prescribers_prescriberorganization"."website", - "prescribers_prescriberorganization"."description", - "prescribers_prescriberorganization"."is_authorized", - "prescribers_prescriberorganization"."code_safir_pole_emploi", - "prescribers_prescriberorganization"."created_by_id", - "prescribers_prescriberorganization"."authorization_status", - "prescribers_prescriberorganization"."authorization_updated_at", - "prescribers_prescriberorganization"."authorization_updated_by_id" - FROM "prescribers_prescribermembership" - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active") - ORDER BY "prescribers_prescribermembership"."created_at" ASC + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC ''', }), dict({ @@ -3881,9 +7558,9 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -3935,8 +7612,8 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -4016,80 +7693,42 @@ }), dict({ 'origin': list([ - 'User.is_prescriber_with_authorized_org[users/models.py]', - 'User.can_edit_personal_information[users/models.py]', - 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - ]), - 'sql': ''' - SELECT %s AS "a" - FROM "prescribers_prescribermembership" - INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active" - AND "prescribers_prescriberorganization"."is_authorized" - AND "users_user"."is_active") - LIMIT 1 - ''', - }), - dict({ - 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'CustomFieldRenderer.render[utils/custom_renderer.py]', - 'SimpleNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - 'IfNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - 'BlockNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'BlockNode[layout/base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - ]), - 'sql': ''' - SELECT "asp_country"."id", - "asp_country"."code", - "asp_country"."name", - "asp_country"."group", - "asp_country"."department" - FROM "asp_country" - ORDER BY "asp_country"."name" ASC - ''', - }), - dict({ - 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'Session.save[/django/db/models/base.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + 'Atomic.__exit__[/django/db/transaction.py]', ]), - 'sql': ''' - UPDATE "django_session" - SET "session_data" = %s, - "expire_date" = %s - WHERE "django_session"."session_key" = %s - ''', + 'sql': 'RELEASE SAVEPOINT ""', }), dict({ 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_3.html]', ]), - 'sql': 'RELEASE SAVEPOINT ""', + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', }), ]), }) # --- -# name: TestUpdateJobSeeker.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 2] +# name: TestUpdateJobSeeker.test_with_job_seeker_without_nir_deprecated[queries - step 2] dict({ 'num_queries': 9, 'queries': list([ @@ -4107,20 +7746,6 @@ LIMIT 21 ''', }), - dict({ - 'origin': list([ - 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - SELECT "django_session"."session_key", - "django_session"."session_data", - "django_session"."expire_date" - FROM "django_session" - WHERE ("django_session"."expire_date" > %s - AND "django_session"."session_key" = %s) - LIMIT 21 - ''', - }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -4168,64 +7793,25 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "prescribers_prescribermembership"."id", - "prescribers_prescribermembership"."user_id", - "prescribers_prescribermembership"."joined_at", - "prescribers_prescribermembership"."is_admin", - "prescribers_prescribermembership"."is_active", - "prescribers_prescribermembership"."created_at", - "prescribers_prescribermembership"."updated_at", - "prescribers_prescribermembership"."organization_id", - "prescribers_prescribermembership"."updated_by_id", - "prescribers_prescriberorganization"."id", - "prescribers_prescriberorganization"."address_line_1", - "prescribers_prescriberorganization"."address_line_2", - "prescribers_prescriberorganization"."post_code", - "prescribers_prescriberorganization"."city", - "prescribers_prescriberorganization"."department", - "prescribers_prescriberorganization"."coords", - "prescribers_prescriberorganization"."geocoding_score", - "prescribers_prescriberorganization"."geocoding_updated_at", - "prescribers_prescriberorganization"."ban_api_resolved_address", - "prescribers_prescriberorganization"."insee_city_id", - "prescribers_prescriberorganization"."name", - "prescribers_prescriberorganization"."created_at", - "prescribers_prescriberorganization"."updated_at", - "prescribers_prescriberorganization"."uid", - "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", - "prescribers_prescriberorganization"."automatic_geocoding_update", - "prescribers_prescriberorganization"."siret", - "prescribers_prescriberorganization"."is_head_office", - "prescribers_prescriberorganization"."kind", - "prescribers_prescriberorganization"."is_brsa", - "prescribers_prescriberorganization"."phone", - "prescribers_prescriberorganization"."email", - "prescribers_prescriberorganization"."website", - "prescribers_prescriberorganization"."description", - "prescribers_prescriberorganization"."is_authorized", - "prescribers_prescriberorganization"."code_safir_pole_emploi", - "prescribers_prescriberorganization"."created_by_id", - "prescribers_prescriberorganization"."authorization_status", - "prescribers_prescriberorganization"."authorization_updated_at", - "prescribers_prescriberorganization"."authorization_updated_by_id" - FROM "prescribers_prescribermembership" - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active") - ORDER BY "prescribers_prescribermembership"."created_at" ASC + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC ''', }), dict({ 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - ]), - 'sql': 'SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -4265,20 +7851,57 @@ "companies_company"."rdv_solidarites_id", EXISTS (SELECT %s AS "a" - FROM "companies_companymembership" U0 - WHERE (U0."company_id" = ("companies_company"."id") - AND U0."is_active") - LIMIT 1) AS "has_active_members" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_company"."id" = %s) - LIMIT 21 + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC ''', }), dict({ 'origin': list([ - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -4315,28 +7938,63 @@ "users_user"."first_login" FROM "users_user" WHERE ("users_user"."kind" = %s - AND "users_user"."id" = %s) + AND "users_user"."public_id" = %s) LIMIT 21 ''', }), dict({ 'origin': list([ - 'User.is_prescriber_with_authorized_org[users/models.py]', - 'User.can_edit_personal_information[users/models.py]', - 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' - SELECT %s AS "a" - FROM "prescribers_prescribermembership" - INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active" - AND "prescribers_prescriberorganization"."is_authorized" - AND "users_user"."is_active") - LIMIT 1 + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 ''', }), dict({ @@ -4345,10 +8003,38 @@ ]), 'sql': 'RELEASE SAVEPOINT ""', }), + dict({ + 'origin': list([ + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_2.html]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', + }), ]), }) # --- -# name: TestUpdateJobSeeker.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 3] +# name: TestUpdateJobSeeker.test_with_job_seeker_without_nir_deprecated[queries - step 3] dict({ 'num_queries': 9, 'queries': list([ @@ -4366,20 +8052,6 @@ LIMIT 21 ''', }), - dict({ - 'origin': list([ - 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - SELECT "django_session"."session_key", - "django_session"."session_data", - "django_session"."expire_date" - FROM "django_session" - WHERE ("django_session"."expire_date" > %s - AND "django_session"."session_key" = %s) - LIMIT 21 - ''', - }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -4427,64 +8099,25 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "prescribers_prescribermembership"."id", - "prescribers_prescribermembership"."user_id", - "prescribers_prescribermembership"."joined_at", - "prescribers_prescribermembership"."is_admin", - "prescribers_prescribermembership"."is_active", - "prescribers_prescribermembership"."created_at", - "prescribers_prescribermembership"."updated_at", - "prescribers_prescribermembership"."organization_id", - "prescribers_prescribermembership"."updated_by_id", - "prescribers_prescriberorganization"."id", - "prescribers_prescriberorganization"."address_line_1", - "prescribers_prescriberorganization"."address_line_2", - "prescribers_prescriberorganization"."post_code", - "prescribers_prescriberorganization"."city", - "prescribers_prescriberorganization"."department", - "prescribers_prescriberorganization"."coords", - "prescribers_prescriberorganization"."geocoding_score", - "prescribers_prescriberorganization"."geocoding_updated_at", - "prescribers_prescriberorganization"."ban_api_resolved_address", - "prescribers_prescriberorganization"."insee_city_id", - "prescribers_prescriberorganization"."name", - "prescribers_prescriberorganization"."created_at", - "prescribers_prescriberorganization"."updated_at", - "prescribers_prescriberorganization"."uid", - "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", - "prescribers_prescriberorganization"."automatic_geocoding_update", - "prescribers_prescriberorganization"."siret", - "prescribers_prescriberorganization"."is_head_office", - "prescribers_prescriberorganization"."kind", - "prescribers_prescriberorganization"."is_brsa", - "prescribers_prescriberorganization"."phone", - "prescribers_prescriberorganization"."email", - "prescribers_prescriberorganization"."website", - "prescribers_prescriberorganization"."description", - "prescribers_prescriberorganization"."is_authorized", - "prescribers_prescriberorganization"."code_safir_pole_emploi", - "prescribers_prescriberorganization"."created_by_id", - "prescribers_prescriberorganization"."authorization_status", - "prescribers_prescriberorganization"."authorization_updated_at", - "prescribers_prescriberorganization"."authorization_updated_by_id" - FROM "prescribers_prescribermembership" - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active") - ORDER BY "prescribers_prescribermembership"."created_at" ASC + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC ''', }), dict({ 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - ]), - 'sql': 'SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -4524,20 +8157,57 @@ "companies_company"."rdv_solidarites_id", EXISTS (SELECT %s AS "a" - FROM "companies_companymembership" U0 - WHERE (U0."company_id" = ("companies_company"."id") - AND U0."is_active") - LIMIT 1) AS "has_active_members" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_company"."id" = %s) - LIMIT 21 + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC ''', }), dict({ 'origin': list([ - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -4611,28 +8281,63 @@ FROM "users_user" LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") WHERE ("users_user"."kind" = %s - AND "users_user"."id" = %s) + AND "users_user"."public_id" = %s) LIMIT 21 ''', }), dict({ 'origin': list([ - 'User.is_prescriber_with_authorized_org[users/models.py]', - 'User.can_edit_personal_information[users/models.py]', - 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' - SELECT %s AS "a" - FROM "prescribers_prescribermembership" - INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active" - AND "prescribers_prescriberorganization"."is_authorized" - AND "users_user"."is_active") - LIMIT 1 + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 ''', }), dict({ @@ -4641,10 +8346,38 @@ ]), 'sql': 'RELEASE SAVEPOINT ""', }), + dict({ + 'origin': list([ + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_3.html]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', + }), ]), }) # --- -# name: TestUpdateJobSeeker.test_with_job_seeker_without_nir[queries - start] +# name: TestUpdateJobSeekerForHire.test_as_authorized_prescriber_with_proxied_job_seeker[queries - start] dict({ 'num_queries': 11, 'queries': list([ @@ -4698,31 +8431,10 @@ "users_user"."last_checked_at", "users_user"."public_id", "users_user"."address_filled_at", - "users_user"."first_login" - FROM "users_user" - WHERE "users_user"."id" = %s - LIMIT 21 - ''', - }), - dict({ - 'origin': list([ - 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', - ]), - 'sql': ''' - SELECT "companies_companymembership"."id", - "companies_companymembership"."user_id", - "companies_companymembership"."joined_at", - "companies_companymembership"."is_admin", - "companies_companymembership"."is_active", - "companies_companymembership"."created_at", - "companies_companymembership"."updated_at", - "companies_companymembership"."company_id", - "companies_companymembership"."updated_by_id", - "companies_companymembership"."notifications" - FROM "companies_companymembership" - WHERE ("companies_companymembership"."user_id" = %s - AND "companies_companymembership"."is_active") - ORDER BY "companies_companymembership"."created_at" ASC + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 ''', }), dict({ @@ -4730,82 +8442,51 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "companies_company"."id", - "companies_company"."address_line_1", - "companies_company"."address_line_2", - "companies_company"."post_code", - "companies_company"."city", - "companies_company"."department", - "companies_company"."coords", - "companies_company"."geocoding_score", - "companies_company"."geocoding_updated_at", - "companies_company"."ban_api_resolved_address", - "companies_company"."insee_city_id", - "companies_company"."name", - "companies_company"."created_at", - "companies_company"."updated_at", - "companies_company"."uid", - "companies_company"."active_members_email_reminder_last_sent_at", - "companies_company"."automatic_geocoding_update", - "companies_company"."siret", - "companies_company"."naf", - "companies_company"."kind", - "companies_company"."brand", - "companies_company"."phone", - "companies_company"."email", - "companies_company"."auth_email", - "companies_company"."website", - "companies_company"."description", - "companies_company"."provided_support", - "companies_company"."source", - "companies_company"."created_by_id", - "companies_company"."block_job_applications", - "companies_company"."job_applications_blocked_at", - "companies_company"."convention_id", - "companies_company"."job_app_score", - "companies_company"."is_searchable", - "companies_company"."rdv_solidarites_id", - EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1) AS "has_convention_in_grace_period", - "companies_siaeconvention"."id", - "companies_siaeconvention"."kind", - "companies_siaeconvention"."siret_signature", - "companies_siaeconvention"."is_active", - "companies_siaeconvention"."deactivated_at", - "companies_siaeconvention"."reactivated_by_id", - "companies_siaeconvention"."reactivated_at", - "companies_siaeconvention"."asp_id", - "companies_siaeconvention"."created_at", - "companies_siaeconvention"."updated_at" - FROM "companies_company" - INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") - LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") - WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_companymembership"."user_id" = %s - AND "companies_company"."id" IN (%s) - AND (NOT ("companies_company"."kind" IN (%s, - %s, - %s, - %s, - %s)) - OR "companies_company"."source" = %s - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."id" = ("companies_company"."convention_id") - AND U0."is_active") - LIMIT 1) - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1))) - ORDER BY RANDOM() ASC + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC ''', }), dict({ @@ -4909,6 +8590,25 @@ LIMIT 21 ''', }), + dict({ + 'origin': list([ + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") + LIMIT 1 + ''', + }), dict({ 'origin': list([ 'Atomic.__exit__[/django/db/transaction.py]', @@ -4944,9 +8644,9 @@ ]), }) # --- -# name: TestUpdateJobSeeker.test_with_job_seeker_without_nir[queries - step 1] +# name: TestUpdateJobSeekerForHire.test_as_authorized_prescriber_with_proxied_job_seeker[queries - step 1] dict({ - 'num_queries': 14, + 'num_queries': 13, 'queries': list([ dict({ 'origin': list([ @@ -5012,114 +8712,62 @@ "users_user"."last_checked_at", "users_user"."public_id", "users_user"."address_filled_at", - "users_user"."first_login" - FROM "users_user" - WHERE "users_user"."id" = %s - LIMIT 21 - ''', - }), - dict({ - 'origin': list([ - 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', - ]), - 'sql': ''' - SELECT "companies_companymembership"."id", - "companies_companymembership"."user_id", - "companies_companymembership"."joined_at", - "companies_companymembership"."is_admin", - "companies_companymembership"."is_active", - "companies_companymembership"."created_at", - "companies_companymembership"."updated_at", - "companies_companymembership"."company_id", - "companies_companymembership"."updated_by_id", - "companies_companymembership"."notifications" - FROM "companies_companymembership" - WHERE ("companies_companymembership"."user_id" = %s - AND "companies_companymembership"."is_active") - ORDER BY "companies_companymembership"."created_at" ASC - ''', - }), - dict({ - 'origin': list([ - 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', - ]), - 'sql': ''' - SELECT "companies_company"."id", - "companies_company"."address_line_1", - "companies_company"."address_line_2", - "companies_company"."post_code", - "companies_company"."city", - "companies_company"."department", - "companies_company"."coords", - "companies_company"."geocoding_score", - "companies_company"."geocoding_updated_at", - "companies_company"."ban_api_resolved_address", - "companies_company"."insee_city_id", - "companies_company"."name", - "companies_company"."created_at", - "companies_company"."updated_at", - "companies_company"."uid", - "companies_company"."active_members_email_reminder_last_sent_at", - "companies_company"."automatic_geocoding_update", - "companies_company"."siret", - "companies_company"."naf", - "companies_company"."kind", - "companies_company"."brand", - "companies_company"."phone", - "companies_company"."email", - "companies_company"."auth_email", - "companies_company"."website", - "companies_company"."description", - "companies_company"."provided_support", - "companies_company"."source", - "companies_company"."created_by_id", - "companies_company"."block_job_applications", - "companies_company"."job_applications_blocked_at", - "companies_company"."convention_id", - "companies_company"."job_app_score", - "companies_company"."is_searchable", - "companies_company"."rdv_solidarites_id", - EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1) AS "has_convention_in_grace_period", - "companies_siaeconvention"."id", - "companies_siaeconvention"."kind", - "companies_siaeconvention"."siret_signature", - "companies_siaeconvention"."is_active", - "companies_siaeconvention"."deactivated_at", - "companies_siaeconvention"."reactivated_by_id", - "companies_siaeconvention"."reactivated_at", - "companies_siaeconvention"."asp_id", - "companies_siaeconvention"."created_at", - "companies_siaeconvention"."updated_at" - FROM "companies_company" - INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") - LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") - WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_companymembership"."user_id" = %s - AND "companies_company"."id" IN (%s) - AND (NOT ("companies_company"."kind" IN (%s, - %s, - %s, - %s, - %s)) - OR "companies_company"."source" = %s - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."id" = ("companies_company"."convention_id") - AND U0."is_active") - LIMIT 1) - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1))) - ORDER BY RANDOM() ASC + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC ''', }), dict({ @@ -5265,38 +8913,30 @@ }), dict({ 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'Company.has_admin[common_apps/organizations/models.py]', - 'Company.convention_can_be_accessed_by[companies/models.py]', - 'nav[utils/templatetags/nav.py]', - 'InclusionNode[layout/_header_authenticated.html]', - 'IncludeNode[layout/base.html]', - 'IfNode[layout/base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT %s AS "a" - FROM "users_user" - INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") - WHERE ("companies_companymembership"."id" IN - (SELECT U0."id" - FROM "companies_companymembership" U0 - INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") - WHERE (U0."company_id" = %s - AND U2."is_active" - AND U0."is_active" - AND U0."is_admin" - AND U2."is_active")) - AND "users_user"."id" = %s) + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") LIMIT 1 ''', }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), dict({ 'origin': list([ 'CustomFieldRenderer.render[utils/custom_renderer.py]', @@ -5346,9 +8986,9 @@ ]), }) # --- -# name: TestUpdateJobSeeker.test_with_job_seeker_without_nir[queries - step 2] +# name: TestUpdateJobSeekerForHire.test_as_authorized_prescriber_with_proxied_job_seeker[queries - step 2] dict({ - 'num_queries': 10, + 'num_queries': 9, 'queries': list([ dict({ 'origin': list([ @@ -5370,158 +9010,106 @@ ]), 'sql': ''' SELECT "django_session"."session_key", - "django_session"."session_data", - "django_session"."expire_date" - FROM "django_session" - WHERE ("django_session"."expire_date" > %s - AND "django_session"."session_key" = %s) - LIMIT 21 - ''', - }), - dict({ - 'origin': list([ - 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', - ]), - 'sql': ''' - SELECT "users_user"."id", - "users_user"."password", - "users_user"."last_login", - "users_user"."is_superuser", - "users_user"."username", - "users_user"."first_name", - "users_user"."last_name", - "users_user"."is_staff", - "users_user"."is_active", - "users_user"."date_joined", - "users_user"."address_line_1", - "users_user"."address_line_2", - "users_user"."post_code", - "users_user"."city", - "users_user"."department", - "users_user"."coords", - "users_user"."geocoding_score", - "users_user"."geocoding_updated_at", - "users_user"."ban_api_resolved_address", - "users_user"."insee_city_id", - "users_user"."title", - "users_user"."email", - "users_user"."phone", - "users_user"."kind", - "users_user"."identity_provider", - "users_user"."has_completed_welcoming_tour", - "users_user"."created_by_id", - "users_user"."external_data_source_history", - "users_user"."last_checked_at", - "users_user"."public_id", - "users_user"."address_filled_at", - "users_user"."first_login" - FROM "users_user" - WHERE "users_user"."id" = %s - LIMIT 21 - ''', - }), - dict({ - 'origin': list([ - 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', - ]), - 'sql': ''' - SELECT "companies_companymembership"."id", - "companies_companymembership"."user_id", - "companies_companymembership"."joined_at", - "companies_companymembership"."is_admin", - "companies_companymembership"."is_active", - "companies_companymembership"."created_at", - "companies_companymembership"."updated_at", - "companies_companymembership"."company_id", - "companies_companymembership"."updated_by_id", - "companies_companymembership"."notifications" - FROM "companies_companymembership" - WHERE ("companies_companymembership"."user_id" = %s - AND "companies_companymembership"."is_active") - ORDER BY "companies_companymembership"."created_at" ASC - ''', - }), - dict({ - 'origin': list([ - 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', - ]), - 'sql': ''' - SELECT "companies_company"."id", - "companies_company"."address_line_1", - "companies_company"."address_line_2", - "companies_company"."post_code", - "companies_company"."city", - "companies_company"."department", - "companies_company"."coords", - "companies_company"."geocoding_score", - "companies_company"."geocoding_updated_at", - "companies_company"."ban_api_resolved_address", - "companies_company"."insee_city_id", - "companies_company"."name", - "companies_company"."created_at", - "companies_company"."updated_at", - "companies_company"."uid", - "companies_company"."active_members_email_reminder_last_sent_at", - "companies_company"."automatic_geocoding_update", - "companies_company"."siret", - "companies_company"."naf", - "companies_company"."kind", - "companies_company"."brand", - "companies_company"."phone", - "companies_company"."email", - "companies_company"."auth_email", - "companies_company"."website", - "companies_company"."description", - "companies_company"."provided_support", - "companies_company"."source", - "companies_company"."created_by_id", - "companies_company"."block_job_applications", - "companies_company"."job_applications_blocked_at", - "companies_company"."convention_id", - "companies_company"."job_app_score", - "companies_company"."is_searchable", - "companies_company"."rdv_solidarites_id", - EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1) AS "has_convention_in_grace_period", - "companies_siaeconvention"."id", - "companies_siaeconvention"."kind", - "companies_siaeconvention"."siret_signature", - "companies_siaeconvention"."is_active", - "companies_siaeconvention"."deactivated_at", - "companies_siaeconvention"."reactivated_by_id", - "companies_siaeconvention"."reactivated_at", - "companies_siaeconvention"."asp_id", - "companies_siaeconvention"."created_at", - "companies_siaeconvention"."updated_at" - FROM "companies_company" - INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") - LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") - WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_companymembership"."user_id" = %s - AND "companies_company"."id" IN (%s) - AND (NOT ("companies_company"."kind" IN (%s, - %s, - %s, - %s, - %s)) - OR "companies_company"."source" = %s - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."id" = ("companies_company"."convention_id") - AND U0."is_active") - LIMIT 1) - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1))) - ORDER BY RANDOM() ASC + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE "users_user"."id" = %s + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC ''', }), dict({ @@ -5630,44 +9218,36 @@ }), dict({ 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'Company.has_admin[common_apps/organizations/models.py]', - 'Company.convention_can_be_accessed_by[companies/models.py]', - 'nav[utils/templatetags/nav.py]', - 'InclusionNode[layout/_header_authenticated.html]', - 'IncludeNode[layout/base.html]', - 'IfNode[layout/base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_2.html]', + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT %s AS "a" - FROM "users_user" - INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") - WHERE ("companies_companymembership"."id" IN - (SELECT U0."id" - FROM "companies_companymembership" U0 - INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") - WHERE (U0."company_id" = %s - AND U2."is_active" - AND U0."is_active" - AND U0."is_admin" - AND U2."is_active")) - AND "users_user"."id" = %s) + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") LIMIT 1 ''', }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), ]), }) # --- -# name: TestUpdateJobSeeker.test_with_job_seeker_without_nir[queries - step 3] +# name: TestUpdateJobSeekerForHire.test_as_authorized_prescriber_with_proxied_job_seeker[queries - step 3] dict({ - 'num_queries': 10, + 'num_queries': 9, 'queries': list([ dict({ 'origin': list([ @@ -5744,103 +9324,51 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "companies_companymembership"."id", - "companies_companymembership"."user_id", - "companies_companymembership"."joined_at", - "companies_companymembership"."is_admin", - "companies_companymembership"."is_active", - "companies_companymembership"."created_at", - "companies_companymembership"."updated_at", - "companies_companymembership"."company_id", - "companies_companymembership"."updated_by_id", - "companies_companymembership"."notifications" - FROM "companies_companymembership" - WHERE ("companies_companymembership"."user_id" = %s - AND "companies_companymembership"."is_active") - ORDER BY "companies_companymembership"."created_at" ASC - ''', - }), - dict({ - 'origin': list([ - 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', - ]), - 'sql': ''' - SELECT "companies_company"."id", - "companies_company"."address_line_1", - "companies_company"."address_line_2", - "companies_company"."post_code", - "companies_company"."city", - "companies_company"."department", - "companies_company"."coords", - "companies_company"."geocoding_score", - "companies_company"."geocoding_updated_at", - "companies_company"."ban_api_resolved_address", - "companies_company"."insee_city_id", - "companies_company"."name", - "companies_company"."created_at", - "companies_company"."updated_at", - "companies_company"."uid", - "companies_company"."active_members_email_reminder_last_sent_at", - "companies_company"."automatic_geocoding_update", - "companies_company"."siret", - "companies_company"."naf", - "companies_company"."kind", - "companies_company"."brand", - "companies_company"."phone", - "companies_company"."email", - "companies_company"."auth_email", - "companies_company"."website", - "companies_company"."description", - "companies_company"."provided_support", - "companies_company"."source", - "companies_company"."created_by_id", - "companies_company"."block_job_applications", - "companies_company"."job_applications_blocked_at", - "companies_company"."convention_id", - "companies_company"."job_app_score", - "companies_company"."is_searchable", - "companies_company"."rdv_solidarites_id", - EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1) AS "has_convention_in_grace_period", - "companies_siaeconvention"."id", - "companies_siaeconvention"."kind", - "companies_siaeconvention"."siret_signature", - "companies_siaeconvention"."is_active", - "companies_siaeconvention"."deactivated_at", - "companies_siaeconvention"."reactivated_by_id", - "companies_siaeconvention"."reactivated_at", - "companies_siaeconvention"."asp_id", - "companies_siaeconvention"."created_at", - "companies_siaeconvention"."updated_at" - FROM "companies_company" - INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") - LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") - WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_companymembership"."user_id" = %s - AND "companies_company"."id" IN (%s) - AND (NOT ("companies_company"."kind" IN (%s, - %s, - %s, - %s, - %s)) - OR "companies_company"."source" = %s - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."id" = ("companies_company"."convention_id") - AND U0."is_active") - LIMIT 1) - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1))) - ORDER BY RANDOM() ASC + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC ''', }), dict({ @@ -5986,42 +9514,34 @@ }), dict({ 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'Company.has_admin[common_apps/organizations/models.py]', - 'Company.convention_can_be_accessed_by[companies/models.py]', - 'nav[utils/templatetags/nav.py]', - 'InclusionNode[layout/_header_authenticated.html]', - 'IncludeNode[layout/base.html]', - 'IfNode[layout/base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_3.html]', + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT %s AS "a" - FROM "users_user" - INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") - WHERE ("companies_companymembership"."id" IN - (SELECT U0."id" - FROM "companies_companymembership" U0 - INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") - WHERE (U0."company_id" = %s - AND U2."is_active" - AND U0."is_active" - AND U0."is_admin" - AND U2."is_active")) - AND "users_user"."id" = %s) + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") LIMIT 1 ''', }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_authorized_prescriber_with_proxied_job_seeker[queries - start] +# name: TestUpdateJobSeekerForHire.test_as_company_with_proxied_job_seeker[queries - start] dict({ 'num_queries': 11, 'queries': list([ @@ -6086,51 +9606,103 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "prescribers_prescribermembership"."id", - "prescribers_prescribermembership"."user_id", - "prescribers_prescribermembership"."joined_at", - "prescribers_prescribermembership"."is_admin", - "prescribers_prescribermembership"."is_active", - "prescribers_prescribermembership"."created_at", - "prescribers_prescribermembership"."updated_at", - "prescribers_prescribermembership"."organization_id", - "prescribers_prescribermembership"."updated_by_id", - "prescribers_prescriberorganization"."id", - "prescribers_prescriberorganization"."address_line_1", - "prescribers_prescriberorganization"."address_line_2", - "prescribers_prescriberorganization"."post_code", - "prescribers_prescriberorganization"."city", - "prescribers_prescriberorganization"."department", - "prescribers_prescriberorganization"."coords", - "prescribers_prescriberorganization"."geocoding_score", - "prescribers_prescriberorganization"."geocoding_updated_at", - "prescribers_prescriberorganization"."ban_api_resolved_address", - "prescribers_prescriberorganization"."insee_city_id", - "prescribers_prescriberorganization"."name", - "prescribers_prescriberorganization"."created_at", - "prescribers_prescriberorganization"."updated_at", - "prescribers_prescriberorganization"."uid", - "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", - "prescribers_prescriberorganization"."automatic_geocoding_update", - "prescribers_prescriberorganization"."siret", - "prescribers_prescriberorganization"."is_head_office", - "prescribers_prescriberorganization"."kind", - "prescribers_prescriberorganization"."is_brsa", - "prescribers_prescriberorganization"."phone", - "prescribers_prescriberorganization"."email", - "prescribers_prescriberorganization"."website", - "prescribers_prescriberorganization"."description", - "prescribers_prescriberorganization"."is_authorized", - "prescribers_prescriberorganization"."code_safir_pole_emploi", - "prescribers_prescriberorganization"."created_by_id", - "prescribers_prescriberorganization"."authorization_status", - "prescribers_prescriberorganization"."authorization_updated_at", - "prescribers_prescriberorganization"."authorization_updated_by_id" - FROM "prescribers_prescribermembership" - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active") - ORDER BY "prescribers_prescribermembership"."created_at" ASC + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC ''', }), dict({ @@ -6217,40 +9789,21 @@ "companies_company"."source", "companies_company"."created_by_id", "companies_company"."block_job_applications", - "companies_company"."job_applications_blocked_at", - "companies_company"."convention_id", - "companies_company"."job_app_score", - "companies_company"."is_searchable", - "companies_company"."rdv_solidarites_id", - EXISTS - (SELECT %s AS "a" - FROM "companies_companymembership" U0 - WHERE (U0."company_id" = ("companies_company"."id") - AND U0."is_active") - LIMIT 1) AS "has_active_members" - FROM "companies_company" - WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_company"."id" = %s) - LIMIT 21 - ''', - }), - dict({ - 'origin': list([ - 'User.is_prescriber_with_authorized_org[users/models.py]', - 'User.can_edit_personal_information[users/models.py]', - 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', - ]), - 'sql': ''' - SELECT %s AS "a" - FROM "prescribers_prescribermembership" - INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active" - AND "prescribers_prescriberorganization"."is_authorized" - AND "users_user"."is_active") - LIMIT 1 + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 ''', }), dict({ @@ -6288,9 +9841,9 @@ ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_authorized_prescriber_with_proxied_job_seeker[queries - step 1] +# name: TestUpdateJobSeekerForHire.test_as_company_with_proxied_job_seeker[queries - step 1] dict({ - 'num_queries': 13, + 'num_queries': 14, 'queries': list([ dict({ 'origin': list([ @@ -6367,51 +9920,103 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "prescribers_prescribermembership"."id", - "prescribers_prescribermembership"."user_id", - "prescribers_prescribermembership"."joined_at", - "prescribers_prescribermembership"."is_admin", - "prescribers_prescribermembership"."is_active", - "prescribers_prescribermembership"."created_at", - "prescribers_prescribermembership"."updated_at", - "prescribers_prescribermembership"."organization_id", - "prescribers_prescribermembership"."updated_by_id", - "prescribers_prescriberorganization"."id", - "prescribers_prescriberorganization"."address_line_1", - "prescribers_prescriberorganization"."address_line_2", - "prescribers_prescriberorganization"."post_code", - "prescribers_prescriberorganization"."city", - "prescribers_prescriberorganization"."department", - "prescribers_prescriberorganization"."coords", - "prescribers_prescriberorganization"."geocoding_score", - "prescribers_prescriberorganization"."geocoding_updated_at", - "prescribers_prescriberorganization"."ban_api_resolved_address", - "prescribers_prescriberorganization"."insee_city_id", - "prescribers_prescriberorganization"."name", - "prescribers_prescriberorganization"."created_at", - "prescribers_prescriberorganization"."updated_at", - "prescribers_prescriberorganization"."uid", - "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", - "prescribers_prescriberorganization"."automatic_geocoding_update", - "prescribers_prescriberorganization"."siret", - "prescribers_prescriberorganization"."is_head_office", - "prescribers_prescriberorganization"."kind", - "prescribers_prescriberorganization"."is_brsa", - "prescribers_prescriberorganization"."phone", - "prescribers_prescriberorganization"."email", - "prescribers_prescriberorganization"."website", - "prescribers_prescriberorganization"."description", - "prescribers_prescriberorganization"."is_authorized", - "prescribers_prescriberorganization"."code_safir_pole_emploi", - "prescribers_prescriberorganization"."created_by_id", - "prescribers_prescriberorganization"."authorization_status", - "prescribers_prescriberorganization"."authorization_updated_at", - "prescribers_prescriberorganization"."authorization_updated_by_id" - FROM "prescribers_prescribermembership" - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active") - ORDER BY "prescribers_prescribermembership"."created_at" ASC + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC ''', }), dict({ @@ -6557,29 +10162,37 @@ }), dict({ 'origin': list([ - 'User.is_prescriber_with_authorized_org[users/models.py]', - 'User.can_edit_personal_information[users/models.py]', - 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'Atomic.__exit__[/django/db/transaction.py]', ]), - 'sql': ''' - SELECT %s AS "a" - FROM "prescribers_prescribermembership" - INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active" - AND "prescribers_prescriberorganization"."is_authorized" - AND "users_user"."is_active") - LIMIT 1 - ''', + 'sql': 'RELEASE SAVEPOINT ""', }), dict({ 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', ]), - 'sql': 'RELEASE SAVEPOINT ""', + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', }), dict({ 'origin': list([ @@ -6630,9 +10243,9 @@ ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_authorized_prescriber_with_proxied_job_seeker[queries - step 2] +# name: TestUpdateJobSeekerForHire.test_as_company_with_proxied_job_seeker[queries - step 2] dict({ - 'num_queries': 9, + 'num_queries': 10, 'queries': list([ dict({ 'origin': list([ @@ -6707,53 +10320,105 @@ dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', - ]), - 'sql': ''' - SELECT "prescribers_prescribermembership"."id", - "prescribers_prescribermembership"."user_id", - "prescribers_prescribermembership"."joined_at", - "prescribers_prescribermembership"."is_admin", - "prescribers_prescribermembership"."is_active", - "prescribers_prescribermembership"."created_at", - "prescribers_prescribermembership"."updated_at", - "prescribers_prescribermembership"."organization_id", - "prescribers_prescribermembership"."updated_by_id", - "prescribers_prescriberorganization"."id", - "prescribers_prescriberorganization"."address_line_1", - "prescribers_prescriberorganization"."address_line_2", - "prescribers_prescriberorganization"."post_code", - "prescribers_prescriberorganization"."city", - "prescribers_prescriberorganization"."department", - "prescribers_prescriberorganization"."coords", - "prescribers_prescriberorganization"."geocoding_score", - "prescribers_prescriberorganization"."geocoding_updated_at", - "prescribers_prescriberorganization"."ban_api_resolved_address", - "prescribers_prescriberorganization"."insee_city_id", - "prescribers_prescriberorganization"."name", - "prescribers_prescriberorganization"."created_at", - "prescribers_prescriberorganization"."updated_at", - "prescribers_prescriberorganization"."uid", - "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", - "prescribers_prescriberorganization"."automatic_geocoding_update", - "prescribers_prescriberorganization"."siret", - "prescribers_prescriberorganization"."is_head_office", - "prescribers_prescriberorganization"."kind", - "prescribers_prescriberorganization"."is_brsa", - "prescribers_prescriberorganization"."phone", - "prescribers_prescriberorganization"."email", - "prescribers_prescriberorganization"."website", - "prescribers_prescriberorganization"."description", - "prescribers_prescriberorganization"."is_authorized", - "prescribers_prescriberorganization"."code_safir_pole_emploi", - "prescribers_prescriberorganization"."created_by_id", - "prescribers_prescriberorganization"."authorization_status", - "prescribers_prescriberorganization"."authorization_updated_at", - "prescribers_prescriberorganization"."authorization_updated_by_id" - FROM "prescribers_prescribermembership" - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active") - ORDER BY "prescribers_prescribermembership"."created_at" ASC + ]), + 'sql': ''' + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC ''', }), dict({ @@ -6862,36 +10527,44 @@ }), dict({ 'origin': list([ - 'User.is_prescriber_with_authorized_org[users/models.py]', - 'User.can_edit_personal_information[users/models.py]', - 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'Atomic.__exit__[/django/db/transaction.py]', ]), - 'sql': ''' - SELECT %s AS "a" - FROM "prescribers_prescribermembership" - INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active" - AND "prescribers_prescriberorganization"."is_authorized" - AND "users_user"."is_active") - LIMIT 1 - ''', + 'sql': 'RELEASE SAVEPOINT ""', }), dict({ 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_2.html]', ]), - 'sql': 'RELEASE SAVEPOINT ""', + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_authorized_prescriber_with_proxied_job_seeker[queries - step 3] +# name: TestUpdateJobSeekerForHire.test_as_company_with_proxied_job_seeker[queries - step 3] dict({ - 'num_queries': 9, + 'num_queries': 10, 'queries': list([ dict({ 'origin': list([ @@ -6968,51 +10641,103 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "prescribers_prescribermembership"."id", - "prescribers_prescribermembership"."user_id", - "prescribers_prescribermembership"."joined_at", - "prescribers_prescribermembership"."is_admin", - "prescribers_prescribermembership"."is_active", - "prescribers_prescribermembership"."created_at", - "prescribers_prescribermembership"."updated_at", - "prescribers_prescribermembership"."organization_id", - "prescribers_prescribermembership"."updated_by_id", - "prescribers_prescriberorganization"."id", - "prescribers_prescriberorganization"."address_line_1", - "prescribers_prescriberorganization"."address_line_2", - "prescribers_prescriberorganization"."post_code", - "prescribers_prescriberorganization"."city", - "prescribers_prescriberorganization"."department", - "prescribers_prescriberorganization"."coords", - "prescribers_prescriberorganization"."geocoding_score", - "prescribers_prescriberorganization"."geocoding_updated_at", - "prescribers_prescriberorganization"."ban_api_resolved_address", - "prescribers_prescriberorganization"."insee_city_id", - "prescribers_prescriberorganization"."name", - "prescribers_prescriberorganization"."created_at", - "prescribers_prescriberorganization"."updated_at", - "prescribers_prescriberorganization"."uid", - "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", - "prescribers_prescriberorganization"."automatic_geocoding_update", - "prescribers_prescriberorganization"."siret", - "prescribers_prescriberorganization"."is_head_office", - "prescribers_prescriberorganization"."kind", - "prescribers_prescriberorganization"."is_brsa", - "prescribers_prescriberorganization"."phone", - "prescribers_prescriberorganization"."email", - "prescribers_prescriberorganization"."website", - "prescribers_prescriberorganization"."description", - "prescribers_prescriberorganization"."is_authorized", - "prescribers_prescriberorganization"."code_safir_pole_emploi", - "prescribers_prescriberorganization"."created_by_id", - "prescribers_prescriberorganization"."authorization_status", - "prescribers_prescriberorganization"."authorization_updated_at", - "prescribers_prescriberorganization"."authorization_updated_by_id" - FROM "prescribers_prescribermembership" - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active") - ORDER BY "prescribers_prescribermembership"."created_at" ASC + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC ''', }), dict({ @@ -7158,36 +10883,44 @@ }), dict({ 'origin': list([ - 'User.is_prescriber_with_authorized_org[users/models.py]', - 'User.can_edit_personal_information[users/models.py]', - 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'Atomic.__exit__[/django/db/transaction.py]', ]), - 'sql': ''' - SELECT %s AS "a" - FROM "prescribers_prescribermembership" - INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active" - AND "prescribers_prescriberorganization"."is_authorized" - AND "users_user"."is_active") - LIMIT 1 - ''', + 'sql': 'RELEASE SAVEPOINT ""', }), dict({ 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_3.html]', ]), - 'sql': 'RELEASE SAVEPOINT ""', + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_company_with_proxied_job_seeker[queries - start] +# name: TestUpdateJobSeekerForHire.test_as_company_with_proxied_job_seeker_deprecated[queries - step 2] dict({ - 'num_queries': 11, + 'num_queries': 10, 'queries': list([ dict({ 'origin': list([ @@ -7357,7 +11090,8 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -7400,7 +11134,10 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -7452,42 +11189,64 @@ }), dict({ 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', + 'Company.has_member[common_apps/organizations/models.py]', + 'DeprecatedUpdateJobSeekerStep2View.dispatch[www/apply/views/submit_views.py]', ]), - 'sql': 'RELEASE SAVEPOINT ""', + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', }), dict({ 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + 'Atomic.__exit__[/django/db/transaction.py]', ]), - 'sql': 'SAVEPOINT ""', + 'sql': 'RELEASE SAVEPOINT ""', }), dict({ 'origin': list([ - 'Session.save[/django/db/models/base.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_2.html]', ]), 'sql': ''' - UPDATE "django_session" - SET "session_data" = %s, - "expire_date" = %s - WHERE "django_session"."session_key" = %s + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 ''', }), - dict({ - 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_company_with_proxied_job_seeker[queries - step 1] +# name: TestUpdateJobSeekerForHire.test_as_company_with_proxied_job_seeker_deprecated[queries - step 3] dict({ - 'num_queries': 14, + 'num_queries': 10, 'queries': list([ dict({ 'origin': list([ @@ -7503,20 +11262,6 @@ LIMIT 21 ''', }), - dict({ - 'origin': list([ - 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - SELECT "django_session"."session_key", - "django_session"."session_data", - "django_session"."expire_date" - FROM "django_session" - WHERE ("django_session"."expire_date" > %s - AND "django_session"."session_key" = %s) - LIMIT 21 - ''', - }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -7671,62 +11416,8 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - ]), - 'sql': ''' - SELECT "companies_company"."id", - "companies_company"."address_line_1", - "companies_company"."address_line_2", - "companies_company"."post_code", - "companies_company"."city", - "companies_company"."department", - "companies_company"."coords", - "companies_company"."geocoding_score", - "companies_company"."geocoding_updated_at", - "companies_company"."ban_api_resolved_address", - "companies_company"."insee_city_id", - "companies_company"."name", - "companies_company"."created_at", - "companies_company"."updated_at", - "companies_company"."uid", - "companies_company"."active_members_email_reminder_last_sent_at", - "companies_company"."automatic_geocoding_update", - "companies_company"."siret", - "companies_company"."naf", - "companies_company"."kind", - "companies_company"."brand", - "companies_company"."phone", - "companies_company"."email", - "companies_company"."auth_email", - "companies_company"."website", - "companies_company"."description", - "companies_company"."provided_support", - "companies_company"."source", - "companies_company"."created_by_id", - "companies_company"."block_job_applications", - "companies_company"."job_applications_blocked_at", - "companies_company"."convention_id", - "companies_company"."job_app_score", - "companies_company"."is_searchable", - "companies_company"."rdv_solidarites_id", - EXISTS - (SELECT %s AS "a" - FROM "companies_companymembership" U0 - WHERE (U0."company_id" = ("companies_company"."id") - AND U0."is_active") - LIMIT 1) AS "has_active_members" - FROM "companies_company" - WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_company"."id" = %s) - LIMIT 21 - ''', - }), - dict({ - 'origin': list([ - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -7798,10 +11489,85 @@ "users_jobseekerprofile"."pe_obfuscated_nir", "users_jobseekerprofile"."pe_last_certification_attempt_at" FROM "users_user" - LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") - WHERE ("users_user"."kind" = %s + LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") + WHERE ("users_user"."kind" = %s + AND "users_user"."public_id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep3View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'Company.has_member[common_apps/organizations/models.py]', + 'DeprecatedUpdateJobSeekerStep3View.dispatch[www/apply/views/submit_views.py]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active")) AND "users_user"."id" = %s) - LIMIT 21 + LIMIT 1 ''', }), dict({ @@ -7819,7 +11585,7 @@ 'IncludeNode[layout/base.html]', 'IfNode[layout/base.html]', 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_3.html]', ]), 'sql': ''' SELECT %s AS "a" @@ -7838,58 +11604,12 @@ LIMIT 1 ''', }), - dict({ - 'origin': list([ - 'CustomFieldRenderer.render[utils/custom_renderer.py]', - 'SimpleNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - 'IfNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - 'BlockNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'BlockNode[layout/base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - ]), - 'sql': ''' - SELECT "asp_country"."id", - "asp_country"."code", - "asp_country"."name", - "asp_country"."group", - "asp_country"."department" - FROM "asp_country" - ORDER BY "asp_country"."name" ASC - ''', - }), - dict({ - 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'Session.save[/django/db/models/base.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - UPDATE "django_session" - SET "session_data" = %s, - "expire_date" = %s - WHERE "django_session"."session_key" = %s - ''', - }), - dict({ - 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_company_with_proxied_job_seeker[queries - step 2] +# name: TestUpdateJobSeekerForHire.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - start] dict({ - 'num_queries': 10, + 'num_queries': 11, 'queries': list([ dict({ 'origin': list([ @@ -7905,20 +11625,6 @@ LIMIT 21 ''', }), - dict({ - 'origin': list([ - 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - SELECT "django_session"."session_key", - "django_session"."session_data", - "django_session"."expire_date" - FROM "django_session" - WHERE ("django_session"."expire_date" > %s - AND "django_session"."session_key" = %s) - LIMIT 21 - ''', - }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -7966,116 +11672,105 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "companies_companymembership"."id", - "companies_companymembership"."user_id", - "companies_companymembership"."joined_at", - "companies_companymembership"."is_admin", - "companies_companymembership"."is_active", - "companies_companymembership"."created_at", - "companies_companymembership"."updated_at", - "companies_companymembership"."company_id", - "companies_companymembership"."updated_by_id", - "companies_companymembership"."notifications" - FROM "companies_companymembership" - WHERE ("companies_companymembership"."user_id" = %s - AND "companies_companymembership"."is_active") - ORDER BY "companies_companymembership"."created_at" ASC + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC ''', }), dict({ 'origin': list([ - 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + 'Atomic.__enter__[/django/db/transaction.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' - SELECT "companies_company"."id", - "companies_company"."address_line_1", - "companies_company"."address_line_2", - "companies_company"."post_code", - "companies_company"."city", - "companies_company"."department", - "companies_company"."coords", - "companies_company"."geocoding_score", - "companies_company"."geocoding_updated_at", - "companies_company"."ban_api_resolved_address", - "companies_company"."insee_city_id", - "companies_company"."name", - "companies_company"."created_at", - "companies_company"."updated_at", - "companies_company"."uid", - "companies_company"."active_members_email_reminder_last_sent_at", - "companies_company"."automatic_geocoding_update", - "companies_company"."siret", - "companies_company"."naf", - "companies_company"."kind", - "companies_company"."brand", - "companies_company"."phone", - "companies_company"."email", - "companies_company"."auth_email", - "companies_company"."website", - "companies_company"."description", - "companies_company"."provided_support", - "companies_company"."source", - "companies_company"."created_by_id", - "companies_company"."block_job_applications", - "companies_company"."job_applications_blocked_at", - "companies_company"."convention_id", - "companies_company"."job_app_score", - "companies_company"."is_searchable", - "companies_company"."rdv_solidarites_id", - EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1) AS "has_convention_in_grace_period", - "companies_siaeconvention"."id", - "companies_siaeconvention"."kind", - "companies_siaeconvention"."siret_signature", - "companies_siaeconvention"."is_active", - "companies_siaeconvention"."deactivated_at", - "companies_siaeconvention"."reactivated_by_id", - "companies_siaeconvention"."reactivated_at", - "companies_siaeconvention"."asp_id", - "companies_siaeconvention"."created_at", - "companies_siaeconvention"."updated_at" - FROM "companies_company" - INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") - LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") - WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_companymembership"."user_id" = %s - AND "companies_company"."id" IN (%s) - AND (NOT ("companies_company"."kind" IN (%s, - %s, - %s, - %s, - %s)) - OR "companies_company"."source" = %s - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."id" = ("companies_company"."convention_id") - AND U0."is_active") - LIMIT 1) - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1))) - ORDER BY RANDOM() ASC + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."public_id" = %s) + LIMIT 21 ''', }), dict({ 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - ]), - 'sql': 'SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -8127,46 +11822,21 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' - SELECT "users_user"."id", - "users_user"."password", - "users_user"."last_login", - "users_user"."is_superuser", - "users_user"."username", - "users_user"."first_name", - "users_user"."last_name", - "users_user"."is_staff", - "users_user"."is_active", - "users_user"."date_joined", - "users_user"."address_line_1", - "users_user"."address_line_2", - "users_user"."post_code", - "users_user"."city", - "users_user"."department", - "users_user"."coords", - "users_user"."geocoding_score", - "users_user"."geocoding_updated_at", - "users_user"."ban_api_resolved_address", - "users_user"."insee_city_id", - "users_user"."title", - "users_user"."email", - "users_user"."phone", - "users_user"."kind", - "users_user"."identity_provider", - "users_user"."has_completed_welcoming_tour", - "users_user"."created_by_id", - "users_user"."external_data_source_history", - "users_user"."last_checked_at", - "users_user"."public_id", - "users_user"."address_filled_at", - "users_user"."first_login" - FROM "users_user" - WHERE ("users_user"."kind" = %s - AND "users_user"."id" = %s) - LIMIT 21 + SELECT %s AS "a" + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") + LIMIT 1 ''', }), dict({ @@ -8177,38 +11847,36 @@ }), dict({ 'origin': list([ - 'Company.has_admin[common_apps/organizations/models.py]', - 'Company.convention_can_be_accessed_by[companies/models.py]', - 'nav[utils/templatetags/nav.py]', - 'InclusionNode[layout/_header_authenticated.html]', - 'IncludeNode[layout/base.html]', - 'IfNode[layout/base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_2.html]', + 'Atomic.__enter__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Session.save[/django/db/models/base.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', ]), 'sql': ''' - SELECT %s AS "a" - FROM "users_user" - INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") - WHERE ("companies_companymembership"."id" IN - (SELECT U0."id" - FROM "companies_companymembership" U0 - INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") - WHERE (U0."company_id" = %s - AND U2."is_active" - AND U0."is_active" - AND U0."is_admin" - AND U2."is_active")) - AND "users_user"."id" = %s) - LIMIT 1 + UPDATE "django_session" + SET "session_data" = %s, + "expire_date" = %s + WHERE "django_session"."session_key" = %s ''', }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_company_with_proxied_job_seeker[queries - step 3] +# name: TestUpdateJobSeekerForHire.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 1] dict({ - 'num_queries': 10, + 'num_queries': 13, 'queries': list([ dict({ 'origin': list([ @@ -8285,103 +11953,51 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "companies_companymembership"."id", - "companies_companymembership"."user_id", - "companies_companymembership"."joined_at", - "companies_companymembership"."is_admin", - "companies_companymembership"."is_active", - "companies_companymembership"."created_at", - "companies_companymembership"."updated_at", - "companies_companymembership"."company_id", - "companies_companymembership"."updated_by_id", - "companies_companymembership"."notifications" - FROM "companies_companymembership" - WHERE ("companies_companymembership"."user_id" = %s - AND "companies_companymembership"."is_active") - ORDER BY "companies_companymembership"."created_at" ASC - ''', - }), - dict({ - 'origin': list([ - 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', - ]), - 'sql': ''' - SELECT "companies_company"."id", - "companies_company"."address_line_1", - "companies_company"."address_line_2", - "companies_company"."post_code", - "companies_company"."city", - "companies_company"."department", - "companies_company"."coords", - "companies_company"."geocoding_score", - "companies_company"."geocoding_updated_at", - "companies_company"."ban_api_resolved_address", - "companies_company"."insee_city_id", - "companies_company"."name", - "companies_company"."created_at", - "companies_company"."updated_at", - "companies_company"."uid", - "companies_company"."active_members_email_reminder_last_sent_at", - "companies_company"."automatic_geocoding_update", - "companies_company"."siret", - "companies_company"."naf", - "companies_company"."kind", - "companies_company"."brand", - "companies_company"."phone", - "companies_company"."email", - "companies_company"."auth_email", - "companies_company"."website", - "companies_company"."description", - "companies_company"."provided_support", - "companies_company"."source", - "companies_company"."created_by_id", - "companies_company"."block_job_applications", - "companies_company"."job_applications_blocked_at", - "companies_company"."convention_id", - "companies_company"."job_app_score", - "companies_company"."is_searchable", - "companies_company"."rdv_solidarites_id", - EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1) AS "has_convention_in_grace_period", - "companies_siaeconvention"."id", - "companies_siaeconvention"."kind", - "companies_siaeconvention"."siret_signature", - "companies_siaeconvention"."is_active", - "companies_siaeconvention"."deactivated_at", - "companies_siaeconvention"."reactivated_by_id", - "companies_siaeconvention"."reactivated_at", - "companies_siaeconvention"."asp_id", - "companies_siaeconvention"."created_at", - "companies_siaeconvention"."updated_at" - FROM "companies_company" - INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") - LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") - WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_companymembership"."user_id" = %s - AND "companies_company"."id" IN (%s) - AND (NOT ("companies_company"."kind" IN (%s, - %s, - %s, - %s, - %s)) - OR "companies_company"."source" = %s - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."id" = ("companies_company"."convention_id") - AND U0."is_active") - LIMIT 1) - OR EXISTS - (SELECT %s AS "a" - FROM "companies_siaeconvention" U0 - WHERE (U0."deactivated_at" >= %s - AND U0."id" = ("companies_company"."convention_id")) - LIMIT 1))) - ORDER BY RANDOM() ASC + SELECT "prescribers_prescribermembership"."id", + "prescribers_prescribermembership"."user_id", + "prescribers_prescribermembership"."joined_at", + "prescribers_prescribermembership"."is_admin", + "prescribers_prescribermembership"."is_active", + "prescribers_prescribermembership"."created_at", + "prescribers_prescribermembership"."updated_at", + "prescribers_prescribermembership"."organization_id", + "prescribers_prescribermembership"."updated_by_id", + "prescribers_prescriberorganization"."id", + "prescribers_prescriberorganization"."address_line_1", + "prescribers_prescriberorganization"."address_line_2", + "prescribers_prescriberorganization"."post_code", + "prescribers_prescriberorganization"."city", + "prescribers_prescriberorganization"."department", + "prescribers_prescriberorganization"."coords", + "prescribers_prescriberorganization"."geocoding_score", + "prescribers_prescriberorganization"."geocoding_updated_at", + "prescribers_prescriberorganization"."ban_api_resolved_address", + "prescribers_prescriberorganization"."insee_city_id", + "prescribers_prescriberorganization"."name", + "prescribers_prescriberorganization"."created_at", + "prescribers_prescriberorganization"."updated_at", + "prescribers_prescriberorganization"."uid", + "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", + "prescribers_prescriberorganization"."automatic_geocoding_update", + "prescribers_prescriberorganization"."siret", + "prescribers_prescriberorganization"."is_head_office", + "prescribers_prescriberorganization"."kind", + "prescribers_prescriberorganization"."is_brsa", + "prescribers_prescriberorganization"."phone", + "prescribers_prescriberorganization"."email", + "prescribers_prescriberorganization"."website", + "prescribers_prescriberorganization"."description", + "prescribers_prescriberorganization"."is_authorized", + "prescribers_prescriberorganization"."code_safir_pole_emploi", + "prescribers_prescriberorganization"."created_by_id", + "prescribers_prescriberorganization"."authorization_status", + "prescribers_prescriberorganization"."authorization_updated_at", + "prescribers_prescriberorganization"."authorization_updated_by_id" + FROM "prescribers_prescribermembership" + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active") + ORDER BY "prescribers_prescribermembership"."created_at" ASC ''', }), dict({ @@ -8392,9 +12008,9 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -8446,8 +12062,8 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -8525,6 +12141,26 @@ LIMIT 21 ''', }), + dict({ + 'origin': list([ + 'User.is_prescriber_with_authorized_org[users/models.py]', + 'User.can_edit_personal_information[users/models.py]', + 'User.can_view_personal_information[users/models.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "prescribers_prescribermembership" + INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") + INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") + WHERE ("prescribers_prescribermembership"."user_id" = %s + AND "prescribers_prescribermembership"."is_active" + AND "prescribers_prescriberorganization"."is_authorized" + AND "users_user"."is_active") + LIMIT 1 + ''', + }), dict({ 'origin': list([ 'Atomic.__exit__[/django/db/transaction.py]', @@ -8533,38 +12169,56 @@ }), dict({ 'origin': list([ - 'Company.has_admin[common_apps/organizations/models.py]', - 'Company.convention_can_be_accessed_by[companies/models.py]', - 'nav[utils/templatetags/nav.py]', - 'InclusionNode[layout/_header_authenticated.html]', - 'IncludeNode[layout/base.html]', - 'IfNode[layout/base.html]', + 'CustomFieldRenderer.render[utils/custom_renderer.py]', + 'SimpleNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'IfNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'BlockNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'BlockNode[layout/base.html]', 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_3.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', ]), 'sql': ''' - SELECT %s AS "a" - FROM "users_user" - INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") - WHERE ("companies_companymembership"."id" IN - (SELECT U0."id" - FROM "companies_companymembership" U0 - INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") - WHERE (U0."company_id" = %s - AND U2."is_active" - AND U0."is_active" - AND U0."is_admin" - AND U2."is_active")) - AND "users_user"."id" = %s) - LIMIT 1 + SELECT "asp_country"."id", + "asp_country"."code", + "asp_country"."name", + "asp_country"."group", + "asp_country"."department" + FROM "asp_country" + ORDER BY "asp_country"."name" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Session.save[/django/db/models/base.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + UPDATE "django_session" + SET "session_data" = %s, + "expire_date" = %s + WHERE "django_session"."session_key" = %s ''', }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - start] +# name: TestUpdateJobSeekerForHire.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 2] dict({ - 'num_queries': 11, + 'num_queries': 9, 'queries': list([ dict({ 'origin': list([ @@ -8580,6 +12234,20 @@ LIMIT 21 ''', }), + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -8682,50 +12350,9 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', - ]), - 'sql': ''' - SELECT "users_user"."id", - "users_user"."password", - "users_user"."last_login", - "users_user"."is_superuser", - "users_user"."username", - "users_user"."first_name", - "users_user"."last_name", - "users_user"."is_staff", - "users_user"."is_active", - "users_user"."date_joined", - "users_user"."address_line_1", - "users_user"."address_line_2", - "users_user"."post_code", - "users_user"."city", - "users_user"."department", - "users_user"."coords", - "users_user"."geocoding_score", - "users_user"."geocoding_updated_at", - "users_user"."ban_api_resolved_address", - "users_user"."insee_city_id", - "users_user"."title", - "users_user"."email", - "users_user"."phone", - "users_user"."kind", - "users_user"."identity_provider", - "users_user"."has_completed_welcoming_tour", - "users_user"."created_by_id", - "users_user"."external_data_source_history", - "users_user"."last_checked_at", - "users_user"."public_id", - "users_user"."address_filled_at", - "users_user"."first_login" - FROM "users_user" - WHERE ("users_user"."kind" = %s - AND "users_user"."public_id" = %s) - LIMIT 21 - ''', - }), - dict({ - 'origin': list([ - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -8775,12 +12402,57 @@ LIMIT 21 ''', }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."id" = %s) + LIMIT 21 + ''', + }), dict({ 'origin': list([ 'User.is_prescriber_with_authorized_org[users/models.py]', 'User.can_edit_personal_information[users/models.py]', 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT %s AS "a" @@ -8800,38 +12472,12 @@ ]), 'sql': 'RELEASE SAVEPOINT ""', }), - dict({ - 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'Session.save[/django/db/models/base.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - UPDATE "django_session" - SET "session_data" = %s, - "expire_date" = %s - WHERE "django_session"."session_key" = %s - ''', - }), - dict({ - 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 1] +# name: TestUpdateJobSeekerForHire.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 3] dict({ - 'num_queries': 13, + 'num_queries': 9, 'queries': list([ dict({ 'origin': list([ @@ -8963,9 +12609,9 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -9017,8 +12663,8 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -9101,8 +12747,8 @@ 'User.is_prescriber_with_authorized_org[users/models.py]', 'User.can_edit_personal_information[users/models.py]', 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT %s AS "a" @@ -9122,58 +12768,12 @@ ]), 'sql': 'RELEASE SAVEPOINT ""', }), - dict({ - 'origin': list([ - 'CustomFieldRenderer.render[utils/custom_renderer.py]', - 'SimpleNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - 'IfNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - 'BlockNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'BlockNode[layout/base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - ]), - 'sql': ''' - SELECT "asp_country"."id", - "asp_country"."code", - "asp_country"."name", - "asp_country"."group", - "asp_country"."department" - FROM "asp_country" - ORDER BY "asp_country"."name" ASC - ''', - }), - dict({ - 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'Session.save[/django/db/models/base.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - UPDATE "django_session" - SET "session_data" = %s, - "expire_date" = %s - WHERE "django_session"."session_key" = %s - ''', - }), - dict({ - 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 2] +# name: TestUpdateJobSeekerForHire.test_with_job_seeker_without_nir[queries - start] dict({ - 'num_queries': 9, + 'num_queries': 11, 'queries': list([ dict({ 'origin': list([ @@ -9189,20 +12789,6 @@ LIMIT 21 ''', }), - dict({ - 'origin': list([ - 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - SELECT "django_session"."session_key", - "django_session"."session_data", - "django_session"."expire_date" - FROM "django_session" - WHERE ("django_session"."expire_date" > %s - AND "django_session"."session_key" = %s) - LIMIT 21 - ''', - }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -9250,51 +12836,103 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "prescribers_prescribermembership"."id", - "prescribers_prescribermembership"."user_id", - "prescribers_prescribermembership"."joined_at", - "prescribers_prescribermembership"."is_admin", - "prescribers_prescribermembership"."is_active", - "prescribers_prescribermembership"."created_at", - "prescribers_prescribermembership"."updated_at", - "prescribers_prescribermembership"."organization_id", - "prescribers_prescribermembership"."updated_by_id", - "prescribers_prescriberorganization"."id", - "prescribers_prescriberorganization"."address_line_1", - "prescribers_prescriberorganization"."address_line_2", - "prescribers_prescriberorganization"."post_code", - "prescribers_prescriberorganization"."city", - "prescribers_prescriberorganization"."department", - "prescribers_prescriberorganization"."coords", - "prescribers_prescriberorganization"."geocoding_score", - "prescribers_prescriberorganization"."geocoding_updated_at", - "prescribers_prescriberorganization"."ban_api_resolved_address", - "prescribers_prescriberorganization"."insee_city_id", - "prescribers_prescriberorganization"."name", - "prescribers_prescriberorganization"."created_at", - "prescribers_prescriberorganization"."updated_at", - "prescribers_prescriberorganization"."uid", - "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", - "prescribers_prescriberorganization"."automatic_geocoding_update", - "prescribers_prescriberorganization"."siret", - "prescribers_prescriberorganization"."is_head_office", - "prescribers_prescriberorganization"."kind", - "prescribers_prescriberorganization"."is_brsa", - "prescribers_prescriberorganization"."phone", - "prescribers_prescriberorganization"."email", - "prescribers_prescriberorganization"."website", - "prescribers_prescriberorganization"."description", - "prescribers_prescriberorganization"."is_authorized", - "prescribers_prescriberorganization"."code_safir_pole_emploi", - "prescribers_prescriberorganization"."created_by_id", - "prescribers_prescriberorganization"."authorization_status", - "prescribers_prescriberorganization"."authorization_updated_at", - "prescribers_prescriberorganization"."authorization_updated_by_id" - FROM "prescribers_prescribermembership" - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active") - ORDER BY "prescribers_prescribermembership"."created_at" ASC + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC ''', }), dict({ @@ -9305,9 +12943,50 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."public_id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -9359,80 +13038,42 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', ]), - 'sql': ''' - SELECT "users_user"."id", - "users_user"."password", - "users_user"."last_login", - "users_user"."is_superuser", - "users_user"."username", - "users_user"."first_name", - "users_user"."last_name", - "users_user"."is_staff", - "users_user"."is_active", - "users_user"."date_joined", - "users_user"."address_line_1", - "users_user"."address_line_2", - "users_user"."post_code", - "users_user"."city", - "users_user"."department", - "users_user"."coords", - "users_user"."geocoding_score", - "users_user"."geocoding_updated_at", - "users_user"."ban_api_resolved_address", - "users_user"."insee_city_id", - "users_user"."title", - "users_user"."email", - "users_user"."phone", - "users_user"."kind", - "users_user"."identity_provider", - "users_user"."has_completed_welcoming_tour", - "users_user"."created_by_id", - "users_user"."external_data_source_history", - "users_user"."last_checked_at", - "users_user"."public_id", - "users_user"."address_filled_at", - "users_user"."first_login" - FROM "users_user" - WHERE ("users_user"."kind" = %s - AND "users_user"."id" = %s) - LIMIT 21 - ''', + 'sql': 'SAVEPOINT ""', }), dict({ 'origin': list([ - 'User.is_prescriber_with_authorized_org[users/models.py]', - 'User.can_edit_personal_information[users/models.py]', - 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'Session.save[/django/db/models/base.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', ]), 'sql': ''' - SELECT %s AS "a" - FROM "prescribers_prescribermembership" - INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active" - AND "prescribers_prescriberorganization"."is_authorized" - AND "users_user"."is_active") - LIMIT 1 + UPDATE "django_session" + SET "session_data" = %s, + "expire_date" = %s + WHERE "django_session"."session_key" = %s ''', }), dict({ 'origin': list([ 'Atomic.__exit__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', ]), 'sql': 'RELEASE SAVEPOINT ""', }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_as_unauthorized_prescriber_that_created_proxied_job_seeker[queries - step 3] +# name: TestUpdateJobSeekerForHire.test_with_job_seeker_without_nir[queries - step 1] dict({ - 'num_queries': 9, + 'num_queries': 14, 'queries': list([ dict({ 'origin': list([ @@ -9509,51 +13150,103 @@ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', ]), 'sql': ''' - SELECT "prescribers_prescribermembership"."id", - "prescribers_prescribermembership"."user_id", - "prescribers_prescribermembership"."joined_at", - "prescribers_prescribermembership"."is_admin", - "prescribers_prescribermembership"."is_active", - "prescribers_prescribermembership"."created_at", - "prescribers_prescribermembership"."updated_at", - "prescribers_prescribermembership"."organization_id", - "prescribers_prescribermembership"."updated_by_id", - "prescribers_prescriberorganization"."id", - "prescribers_prescriberorganization"."address_line_1", - "prescribers_prescriberorganization"."address_line_2", - "prescribers_prescriberorganization"."post_code", - "prescribers_prescriberorganization"."city", - "prescribers_prescriberorganization"."department", - "prescribers_prescriberorganization"."coords", - "prescribers_prescriberorganization"."geocoding_score", - "prescribers_prescriberorganization"."geocoding_updated_at", - "prescribers_prescriberorganization"."ban_api_resolved_address", - "prescribers_prescriberorganization"."insee_city_id", - "prescribers_prescriberorganization"."name", - "prescribers_prescriberorganization"."created_at", - "prescribers_prescriberorganization"."updated_at", - "prescribers_prescriberorganization"."uid", - "prescribers_prescriberorganization"."active_members_email_reminder_last_sent_at", - "prescribers_prescriberorganization"."automatic_geocoding_update", - "prescribers_prescriberorganization"."siret", - "prescribers_prescriberorganization"."is_head_office", - "prescribers_prescriberorganization"."kind", - "prescribers_prescriberorganization"."is_brsa", - "prescribers_prescriberorganization"."phone", - "prescribers_prescriberorganization"."email", - "prescribers_prescriberorganization"."website", - "prescribers_prescriberorganization"."description", - "prescribers_prescriberorganization"."is_authorized", - "prescribers_prescriberorganization"."code_safir_pole_emploi", - "prescribers_prescriberorganization"."created_by_id", - "prescribers_prescriberorganization"."authorization_status", - "prescribers_prescriberorganization"."authorization_updated_at", - "prescribers_prescriberorganization"."authorization_updated_by_id" - FROM "prescribers_prescribermembership" - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active") - ORDER BY "prescribers_prescribermembership"."created_at" ASC + SELECT "companies_companymembership"."id", + "companies_companymembership"."user_id", + "companies_companymembership"."joined_at", + "companies_companymembership"."is_admin", + "companies_companymembership"."is_active", + "companies_companymembership"."created_at", + "companies_companymembership"."updated_at", + "companies_companymembership"."company_id", + "companies_companymembership"."updated_by_id", + "companies_companymembership"."notifications" + FROM "companies_companymembership" + WHERE ("companies_companymembership"."user_id" = %s + AND "companies_companymembership"."is_active") + ORDER BY "companies_companymembership"."created_at" ASC + ''', + }), + dict({ + 'origin': list([ + 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1) AS "has_convention_in_grace_period", + "companies_siaeconvention"."id", + "companies_siaeconvention"."kind", + "companies_siaeconvention"."siret_signature", + "companies_siaeconvention"."is_active", + "companies_siaeconvention"."deactivated_at", + "companies_siaeconvention"."reactivated_by_id", + "companies_siaeconvention"."reactivated_at", + "companies_siaeconvention"."asp_id", + "companies_siaeconvention"."created_at", + "companies_siaeconvention"."updated_at" + FROM "companies_company" + INNER JOIN "companies_companymembership" ON ("companies_company"."id" = "companies_companymembership"."company_id") + LEFT OUTER JOIN "companies_siaeconvention" ON ("companies_company"."convention_id" = "companies_siaeconvention"."id") + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_companymembership"."user_id" = %s + AND "companies_company"."id" IN (%s) + AND (NOT ("companies_company"."kind" IN (%s, + %s, + %s, + %s, + %s)) + OR "companies_company"."source" = %s + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."id" = ("companies_company"."convention_id") + AND U0."is_active") + LIMIT 1) + OR EXISTS + (SELECT %s AS "a" + FROM "companies_siaeconvention" U0 + WHERE (U0."deactivated_at" >= %s + AND U0."id" = ("companies_company"."convention_id")) + LIMIT 1))) + ORDER BY RANDOM() ASC ''', }), dict({ @@ -9564,9 +13257,9 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -9618,8 +13311,8 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -9694,41 +13387,95 @@ LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") WHERE ("users_user"."kind" = %s AND "users_user"."id" = %s) - LIMIT 21 + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__exit__[/django/db/transaction.py]', + ]), + 'sql': 'RELEASE SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 ''', }), dict({ 'origin': list([ - 'User.is_prescriber_with_authorized_org[users/models.py]', - 'User.can_edit_personal_information[users/models.py]', - 'User.can_view_personal_information[users/models.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'CustomFieldRenderer.render[utils/custom_renderer.py]', + 'SimpleNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'IfNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'BlockNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'BlockNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', ]), 'sql': ''' - SELECT %s AS "a" - FROM "prescribers_prescribermembership" - INNER JOIN "users_user" ON ("prescribers_prescribermembership"."user_id" = "users_user"."id") - INNER JOIN "prescribers_prescriberorganization" ON ("prescribers_prescribermembership"."organization_id" = "prescribers_prescriberorganization"."id") - WHERE ("prescribers_prescribermembership"."user_id" = %s - AND "prescribers_prescribermembership"."is_active" - AND "prescribers_prescriberorganization"."is_authorized" - AND "users_user"."is_active") - LIMIT 1 + SELECT "asp_country"."id", + "asp_country"."code", + "asp_country"."name", + "asp_country"."group", + "asp_country"."department" + FROM "asp_country" + ORDER BY "asp_country"."name" ASC + ''', + }), + dict({ + 'origin': list([ + 'Atomic.__enter__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': 'SAVEPOINT ""', + }), + dict({ + 'origin': list([ + 'Session.save[/django/db/models/base.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + UPDATE "django_session" + SET "session_data" = %s, + "expire_date" = %s + WHERE "django_session"."session_key" = %s ''', }), dict({ 'origin': list([ 'Atomic.__exit__[/django/db/transaction.py]', + 'SessionStore.save[/django/contrib/sessions/backends/db.py]', ]), 'sql': 'RELEASE SAVEPOINT ""', }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_with_job_seeker_without_nir[queries - start] +# name: TestUpdateJobSeekerForHire.test_with_job_seeker_without_nir[queries - step 2] dict({ - 'num_queries': 11, + 'num_queries': 10, 'queries': list([ dict({ 'origin': list([ @@ -9744,6 +13491,20 @@ LIMIT 21 ''', }), + dict({ + 'origin': list([ + 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', + ]), + 'sql': ''' + SELECT "django_session"."session_key", + "django_session"."session_data", + "django_session"."expire_date" + FROM "django_session" + WHERE ("django_session"."expire_date" > %s + AND "django_session"."session_key" = %s) + LIMIT 21 + ''', + }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -9898,50 +13659,9 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', - ]), - 'sql': ''' - SELECT "users_user"."id", - "users_user"."password", - "users_user"."last_login", - "users_user"."is_superuser", - "users_user"."username", - "users_user"."first_name", - "users_user"."last_name", - "users_user"."is_staff", - "users_user"."is_active", - "users_user"."date_joined", - "users_user"."address_line_1", - "users_user"."address_line_2", - "users_user"."post_code", - "users_user"."city", - "users_user"."department", - "users_user"."coords", - "users_user"."geocoding_score", - "users_user"."geocoding_updated_at", - "users_user"."ban_api_resolved_address", - "users_user"."insee_city_id", - "users_user"."title", - "users_user"."email", - "users_user"."phone", - "users_user"."kind", - "users_user"."identity_provider", - "users_user"."has_completed_welcoming_tour", - "users_user"."created_by_id", - "users_user"."external_data_source_history", - "users_user"."last_checked_at", - "users_user"."public_id", - "users_user"."address_filled_at", - "users_user"."first_login" - FROM "users_user" - WHERE ("users_user"."kind" = %s - AND "users_user"."public_id" = %s) - LIMIT 21 - ''', - }), - dict({ - 'origin': list([ - 'UpdateJobSeekerStartView.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -9993,42 +13713,88 @@ }), dict({ 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), - 'sql': 'RELEASE SAVEPOINT ""', + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."id" = %s) + LIMIT 21 + ''', }), dict({ 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + 'Atomic.__exit__[/django/db/transaction.py]', ]), - 'sql': 'SAVEPOINT ""', + 'sql': 'RELEASE SAVEPOINT ""', }), dict({ 'origin': list([ - 'Session.save[/django/db/models/base.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', + 'Company.has_admin[common_apps/organizations/models.py]', + 'Company.convention_can_be_accessed_by[companies/models.py]', + 'nav[utils/templatetags/nav.py]', + 'InclusionNode[layout/_header_authenticated.html]', + 'IncludeNode[layout/base.html]', + 'IfNode[layout/base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_2.html]', ]), 'sql': ''' - UPDATE "django_session" - SET "session_data" = %s, - "expire_date" = %s - WHERE "django_session"."session_key" = %s + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active" + AND U0."is_admin" + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 ''', }), - dict({ - 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_with_job_seeker_without_nir[queries - step 1] +# name: TestUpdateJobSeekerForHire.test_with_job_seeker_without_nir[queries - step 3] dict({ - 'num_queries': 14, + 'num_queries': 10, 'queries': list([ dict({ 'origin': list([ @@ -10212,9 +13978,9 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -10266,8 +14032,8 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep1View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -10360,7 +14126,7 @@ 'IncludeNode[layout/base.html]', 'IfNode[layout/base.html]', 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', + 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_3.html]', ]), 'sql': ''' SELECT %s AS "a" @@ -10374,61 +14140,15 @@ AND U2."is_active" AND U0."is_active" AND U0."is_admin" - AND U2."is_active")) - AND "users_user"."id" = %s) - LIMIT 1 - ''', - }), - dict({ - 'origin': list([ - 'CustomFieldRenderer.render[utils/custom_renderer.py]', - 'SimpleNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - 'IfNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - 'BlockNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'BlockNode[layout/base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_base.html]', - 'ExtendsNode[job_seekers_views/create_or_update_job_seeker/step_1.html]', - ]), - 'sql': ''' - SELECT "asp_country"."id", - "asp_country"."code", - "asp_country"."name", - "asp_country"."group", - "asp_country"."department" - FROM "asp_country" - ORDER BY "asp_country"."name" ASC - ''', - }), - dict({ - 'origin': list([ - 'Atomic.__enter__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'SAVEPOINT ""', - }), - dict({ - 'origin': list([ - 'Session.save[/django/db/models/base.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - UPDATE "django_session" - SET "session_data" = %s, - "expire_date" = %s - WHERE "django_session"."session_key" = %s + AND U2."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 ''', }), - dict({ - 'origin': list([ - 'Atomic.__exit__[/django/db/transaction.py]', - 'SessionStore.save[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': 'RELEASE SAVEPOINT ""', - }), ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_with_job_seeker_without_nir[queries - step 2] +# name: TestUpdateJobSeekerForHire.test_with_job_seeker_without_nir_deprecated[queries - step 2] dict({ 'num_queries': 10, 'queries': list([ @@ -10446,20 +14166,6 @@ LIMIT 21 ''', }), - dict({ - 'origin': list([ - 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - SELECT "django_session"."session_key", - "django_session"."session_data", - "django_session"."expire_date" - FROM "django_session" - WHERE ("django_session"."expire_date" > %s - AND "django_session"."session_key" = %s) - LIMIT 21 - ''', - }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -10614,9 +14320,54 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "users_user"."id", + "users_user"."password", + "users_user"."last_login", + "users_user"."is_superuser", + "users_user"."username", + "users_user"."first_name", + "users_user"."last_name", + "users_user"."is_staff", + "users_user"."is_active", + "users_user"."date_joined", + "users_user"."address_line_1", + "users_user"."address_line_2", + "users_user"."post_code", + "users_user"."city", + "users_user"."department", + "users_user"."coords", + "users_user"."geocoding_score", + "users_user"."geocoding_updated_at", + "users_user"."ban_api_resolved_address", + "users_user"."insee_city_id", + "users_user"."title", + "users_user"."email", + "users_user"."phone", + "users_user"."kind", + "users_user"."identity_provider", + "users_user"."has_completed_welcoming_tour", + "users_user"."created_by_id", + "users_user"."external_data_source_history", + "users_user"."last_checked_at", + "users_user"."public_id", + "users_user"."address_filled_at", + "users_user"."first_login" + FROM "users_user" + WHERE ("users_user"."kind" = %s + AND "users_user"."public_id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep2View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "companies_company"."id", @@ -10668,46 +14419,22 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep2View.setup[www/job_seekers_views/views.py]', + 'Company.has_member[common_apps/organizations/models.py]', + 'DeprecatedUpdateJobSeekerStep2View.dispatch[www/apply/views/submit_views.py]', ]), 'sql': ''' - SELECT "users_user"."id", - "users_user"."password", - "users_user"."last_login", - "users_user"."is_superuser", - "users_user"."username", - "users_user"."first_name", - "users_user"."last_name", - "users_user"."is_staff", - "users_user"."is_active", - "users_user"."date_joined", - "users_user"."address_line_1", - "users_user"."address_line_2", - "users_user"."post_code", - "users_user"."city", - "users_user"."department", - "users_user"."coords", - "users_user"."geocoding_score", - "users_user"."geocoding_updated_at", - "users_user"."ban_api_resolved_address", - "users_user"."insee_city_id", - "users_user"."title", - "users_user"."email", - "users_user"."phone", - "users_user"."kind", - "users_user"."identity_provider", - "users_user"."has_completed_welcoming_tour", - "users_user"."created_by_id", - "users_user"."external_data_source_history", - "users_user"."last_checked_at", - "users_user"."public_id", - "users_user"."address_filled_at", - "users_user"."first_login" + SELECT %s AS "a" FROM "users_user" - WHERE ("users_user"."kind" = %s + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active")) AND "users_user"."id" = %s) - LIMIT 21 + LIMIT 1 ''', }), dict({ @@ -10747,7 +14474,7 @@ ]), }) # --- -# name: TestUpdateJobSeekerForHire.test_with_job_seeker_without_nir[queries - step 3] +# name: TestUpdateJobSeekerForHire.test_with_job_seeker_without_nir_deprecated[queries - step 3] dict({ 'num_queries': 10, 'queries': list([ @@ -10765,20 +14492,6 @@ LIMIT 21 ''', }), - dict({ - 'origin': list([ - 'SessionStore._get_session_from_db[/django/contrib/sessions/backends/db.py]', - ]), - 'sql': ''' - SELECT "django_session"."session_key", - "django_session"."session_data", - "django_session"."expire_date" - FROM "django_session" - WHERE ("django_session"."expire_date" > %s - AND "django_session"."session_key" = %s) - LIMIT 21 - ''', - }), dict({ 'origin': list([ 'ItouCurrentOrganizationMiddleware.__call__[utils/perms/middleware.py]', @@ -10933,62 +14646,8 @@ }), dict({ 'origin': list([ - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - ]), - 'sql': ''' - SELECT "companies_company"."id", - "companies_company"."address_line_1", - "companies_company"."address_line_2", - "companies_company"."post_code", - "companies_company"."city", - "companies_company"."department", - "companies_company"."coords", - "companies_company"."geocoding_score", - "companies_company"."geocoding_updated_at", - "companies_company"."ban_api_resolved_address", - "companies_company"."insee_city_id", - "companies_company"."name", - "companies_company"."created_at", - "companies_company"."updated_at", - "companies_company"."uid", - "companies_company"."active_members_email_reminder_last_sent_at", - "companies_company"."automatic_geocoding_update", - "companies_company"."siret", - "companies_company"."naf", - "companies_company"."kind", - "companies_company"."brand", - "companies_company"."phone", - "companies_company"."email", - "companies_company"."auth_email", - "companies_company"."website", - "companies_company"."description", - "companies_company"."provided_support", - "companies_company"."source", - "companies_company"."created_by_id", - "companies_company"."block_job_applications", - "companies_company"."job_applications_blocked_at", - "companies_company"."convention_id", - "companies_company"."job_app_score", - "companies_company"."is_searchable", - "companies_company"."rdv_solidarites_id", - EXISTS - (SELECT %s AS "a" - FROM "companies_companymembership" U0 - WHERE (U0."company_id" = ("companies_company"."id") - AND U0."is_active") - LIMIT 1) AS "has_active_members" - FROM "companies_company" - WHERE (NOT ("companies_company"."siret" = %s) - AND "companies_company"."id" = %s) - LIMIT 21 - ''', - }), - dict({ - 'origin': list([ - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', - 'UpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', ]), 'sql': ''' SELECT "users_user"."id", @@ -11062,10 +14721,85 @@ FROM "users_user" LEFT OUTER JOIN "users_jobseekerprofile" ON ("users_user"."id" = "users_jobseekerprofile"."user_id") WHERE ("users_user"."kind" = %s - AND "users_user"."id" = %s) + AND "users_user"."public_id" = %s) + LIMIT 21 + ''', + }), + dict({ + 'origin': list([ + 'DeprecatedUpdateJobSeekerStep3View.setup[www/apply/views/submit_views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[utils/session.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + 'DeprecatedUpdateJobSeekerStep3View.setup[www/job_seekers_views/views.py]', + ]), + 'sql': ''' + SELECT "companies_company"."id", + "companies_company"."address_line_1", + "companies_company"."address_line_2", + "companies_company"."post_code", + "companies_company"."city", + "companies_company"."department", + "companies_company"."coords", + "companies_company"."geocoding_score", + "companies_company"."geocoding_updated_at", + "companies_company"."ban_api_resolved_address", + "companies_company"."insee_city_id", + "companies_company"."name", + "companies_company"."created_at", + "companies_company"."updated_at", + "companies_company"."uid", + "companies_company"."active_members_email_reminder_last_sent_at", + "companies_company"."automatic_geocoding_update", + "companies_company"."siret", + "companies_company"."naf", + "companies_company"."kind", + "companies_company"."brand", + "companies_company"."phone", + "companies_company"."email", + "companies_company"."auth_email", + "companies_company"."website", + "companies_company"."description", + "companies_company"."provided_support", + "companies_company"."source", + "companies_company"."created_by_id", + "companies_company"."block_job_applications", + "companies_company"."job_applications_blocked_at", + "companies_company"."convention_id", + "companies_company"."job_app_score", + "companies_company"."is_searchable", + "companies_company"."rdv_solidarites_id", + EXISTS + (SELECT %s AS "a" + FROM "companies_companymembership" U0 + WHERE (U0."company_id" = ("companies_company"."id") + AND U0."is_active") + LIMIT 1) AS "has_active_members" + FROM "companies_company" + WHERE (NOT ("companies_company"."siret" = %s) + AND "companies_company"."id" = %s) LIMIT 21 ''', }), + dict({ + 'origin': list([ + 'Company.has_member[common_apps/organizations/models.py]', + 'DeprecatedUpdateJobSeekerStep3View.dispatch[www/apply/views/submit_views.py]', + ]), + 'sql': ''' + SELECT %s AS "a" + FROM "users_user" + INNER JOIN "companies_companymembership" ON ("users_user"."id" = "companies_companymembership"."user_id") + WHERE ("companies_companymembership"."id" IN + (SELECT U0."id" + FROM "companies_companymembership" U0 + INNER JOIN "users_user" U2 ON (U0."user_id" = U2."id") + WHERE (U0."company_id" = %s + AND U2."is_active" + AND U0."is_active")) + AND "users_user"."id" = %s) + LIMIT 1 + ''', + }), dict({ 'origin': list([ 'Atomic.__exit__[/django/db/transaction.py]', diff --git a/tests/www/apply/test_submit.py b/tests/www/apply/test_submit.py index c21b196df27..f06cf23c571 100644 --- a/tests/www/apply/test_submit.py +++ b/tests/www/apply/test_submit.py @@ -270,6 +270,17 @@ def test_404_when_trying_to_update_a_prescriber(self, client): response = client.get(url) assert response.status_code == 404 + # TODO(ewen): deprecated URL + for viewname in [ + "job_seekers_views:update_job_seeker_step_1_for_hire", + "job_seekers_views:update_job_seeker_step_2_for_hire", + "job_seekers_views:update_job_seeker_step_3_for_hire", + "job_seekers_views:update_job_seeker_step_end_for_hire", + ]: + url = reverse(viewname, kwargs={"company_pk": company.pk, "job_seeker_public_id": prescriber.public_id}) + response = client.get(url) + assert response.status_code == 404 + def test_404_when_trying_to_hire_a_prescriber(self, client): company = CompanyFactory(with_jobs=True, with_membership=True) prescriber = PrescriberFactory() @@ -3473,10 +3484,27 @@ def setup_method(self, settings, mocker): "config": {"from_url": from_url}, "job_seeker_pk": self.job_seeker.pk, } + self.step_1_url = reverse( + self.STEP_1_VIEW_NAME, + kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id}, + ) + self.step_2_url = reverse( + self.STEP_2_VIEW_NAME, + kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id}, + ) + self.step_3_url = reverse( + self.STEP_3_VIEW_NAME, + kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id}, + ) + self.step_end_url = reverse( + self.STEP_END_VIEW_NAME, + kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id}, + ) [self.city] = create_test_cities(["67"], num_per_department=1) self.INFO_MODIFIABLE_PAR_CANDIDAT_UNIQUEMENT = "Informations modifiables par le candidat uniquement" + self.job_seeker_session_key = f"job_seeker-{self.job_seeker.public_id}" settings.API_BAN_BASE_URL = "http://ban-api" mocker.patch( @@ -3507,11 +3535,27 @@ def _check_nothing_permitted(self, client, user): response = client.get(self.start_url) assert response.status_code == 403 + def _check_nothing_permitted_deprecated(self, client, user): + client.force_login(user) + for url in [ + self.step_1_url, + self.step_2_url, + self.step_3_url, + self.step_end_url, + ]: + response = client.get(url) + assert response.status_code == 403 + def _check_that_last_step_doesnt_crash_with_direct_access(self, client, user): client.force_login(user) client.get(self.start_url) # Setup job_seeker_session client.get(self.get_step_url("end", client)) # Use partial job_seeker_session + def _check_that_last_step_doesnt_crash_with_direct_access_deprecated(self, client, user): + client.force_login(user) + client.get(self.step_1_url) # Setup job_seeker_session + client.get(self.step_end_url) # Use partial job_seeker_session + def _check_everything_allowed(self, client, snapshot, user, extra_post_data_1=None): client.force_login(user) @@ -3703,6 +3747,192 @@ def _check_everything_allowed(self, client, snapshot, user, extra_post_data_1=No assert self.job_seeker.last_checked_at != previous_last_checked_at + def _check_everything_allowed_deprecated(self, client, snapshot, user, extra_post_data_1=None): + client.force_login(user) + + # STEP 1 + response = client.get(self.step_1_url) + assertContains(response, self.job_seeker.first_name) + assertNotContains(response, self.INFO_MODIFIABLE_PAR_CANDIDAT_UNIQUEMENT) + + # Let's check for consistency between the NIR, the birthdate and the title. + # (but do not check when there is no NIR) + # ---------------------------------------------------------------------- + + if self.job_seeker.jobseeker_profile.nir != "": + post_data = { + "title": "MME", # Inconsistent title + "first_name": self.job_seeker.first_name, + "last_name": self.job_seeker.last_name, + "birthdate": self.job_seeker.jobseeker_profile.birthdate, + "lack_of_nir": False, + "lack_of_nir_reason": "", + } + response = client.post(self.step_1_url, data=post_data) + assert response.status_code == 200 + assertContains(response, JobSeekerProfile.ERROR_JOBSEEKER_INCONSISTENT_NIR_TITLE % "") + + post_data = { + "title": "M", + "first_name": self.job_seeker.first_name, + "last_name": self.job_seeker.last_name, + "birthdate": datetime.date(1978, 11, 20), # Inconsistent birthdate + "lack_of_nir": False, + "lack_of_nir_reason": "", + } + response = client.post(self.step_1_url, data=post_data) + assert response.status_code == 200 + assertContains(response, JobSeekerProfile.ERROR_JOBSEEKER_INCONSISTENT_NIR_BIRTHDATE % "") + + # Resume to valid data and proceed with "normal" flow. + # ---------------------------------------------------------------------- + + NEW_FIRST_NAME = "New first name" + PROCESS_TITLE = "Modification du compte candidat" + + post_data = { + "title": "M", + "first_name": NEW_FIRST_NAME, + "last_name": "New last name", + "birthdate": self.job_seeker.jobseeker_profile.birthdate, + "lack_of_nir": False, + "lack_of_nir_reason": "", + } + if extra_post_data_1 is not None: + post_data.update(extra_post_data_1) + response = client.post(self.step_1_url, data=post_data) + assertRedirects(response, self.step_2_url, fetch_redirect_response=False) + + # Data is stored in the session but user is untouched + # (nir value is retrieved from the job_seeker and stored in the session) + lack_of_nir_reason = post_data.pop("lack_of_nir_reason") + nir = post_data.pop("nir", None) + birthdate = post_data.pop("birthdate", None) + birth_place = post_data.pop("birth_place", None) + birth_country = post_data.pop("birth_country", None) + expected_job_seeker_session = { + "user": post_data, + "profile": { + "birth_place": birth_place or self.job_seeker.jobseeker_profile.birth_place, + "birth_country": birth_country or self.job_seeker.jobseeker_profile.birth_country, + "birthdate": birthdate or self.job_seeker.jobseeker_profile.birthdate, + "nir": nir or self.job_seeker.jobseeker_profile.nir, + "lack_of_nir_reason": lack_of_nir_reason, + }, + } + assert client.session[self.job_seeker_session_key] == expected_job_seeker_session + self.job_seeker.refresh_from_db() + assert self.job_seeker.first_name != NEW_FIRST_NAME + + # If you go back to step 1, new data is shown + response = client.get(self.step_1_url) + assertContains(response, PROCESS_TITLE, html=True) + assertContains(response, NEW_FIRST_NAME) + + # STEP 2 + with assertSnapshotQueries(snapshot(name="queries - step 2")): + response = client.get(self.step_2_url) + assertContains(response, PROCESS_TITLE, html=True) + assertContains(response, self.job_seeker.phone) + assertNotContains(response, self.INFO_MODIFIABLE_PAR_CANDIDAT_UNIQUEMENT) + + NEW_ADDRESS_LINE = "382 ROUTE DE JOLLIVET" + + fields = [NEW_ADDRESS_LINE, f"{self.city.post_codes[0]} {self.city}"] + new_geocoding_address = ", ".join([field for field in fields if field]) + + post_data = { + "ban_api_resolved_address": new_geocoding_address, + "address_line_1": NEW_ADDRESS_LINE, + "post_code": self.city.post_codes[0], + "insee_code": self.city.code_insee, + "city": self.city.name, + "phone": self.job_seeker.phone, + "fill_mode": "ban_api", + } + + response = client.post(self.step_2_url, data=post_data) + assertRedirects(response, self.step_3_url, fetch_redirect_response=False) + + # Data is stored in the session but user is untouched + expected_job_seeker_session["user"] |= post_data | {"address_line_2": "", "address_for_autocomplete": None} + assert client.session[self.job_seeker_session_key] == expected_job_seeker_session + self.job_seeker.refresh_from_db() + assert self.job_seeker.address_line_1 != NEW_ADDRESS_LINE + + # If you go back to step 2, new data is shown + response = client.get(self.step_2_url) + assertContains(response, NEW_ADDRESS_LINE) + + # STEP 3 + with assertSnapshotQueries(snapshot(name="queries - step 3")): + response = client.get(self.step_3_url) + assertContains(response, PROCESS_TITLE, html=True) + assertContains(response, "Niveau de formation") + + post_data = { + "education_level": EducationLevel.BAC_LEVEL.value, + } + response = client.post(self.step_3_url, data=post_data) + assertRedirects(response, self.step_end_url, fetch_redirect_response=False) + + # Data is stored in the session but user & profiles are untouched + expected_job_seeker_session["profile"] |= post_data | { + "pole_emploi_id": "", + "lack_of_pole_emploi_id_reason": LackOfPoleEmploiId.REASON_NOT_REGISTERED, + "resourceless": False, + "rqth_employee": False, + "oeth_employee": False, + "pole_emploi": False, + "pole_emploi_id_forgotten": "", + "pole_emploi_since": "", + "unemployed": False, + "unemployed_since": "", + "rsa_allocation": False, + "has_rsa_allocation": RSAAllocation.NO.value, + "rsa_allocation_since": "", + "ass_allocation": False, + "ass_allocation_since": "", + "aah_allocation": False, + "aah_allocation_since": "", + } + assert client.session[self.job_seeker_session_key] == expected_job_seeker_session + self.job_seeker.refresh_from_db() + + # If you go back to step 3, new data is shown + response = client.get(self.step_3_url) + assertContains(response, '', html=True) + + # Step END + response = client.get(self.step_end_url) + assertContains(response, PROCESS_TITLE, html=True) + assertContains(response, NEW_FIRST_NAME.title()) # User.get_full_name() changes the firstname display + assertContains(response, NEW_ADDRESS_LINE) + assertContains(response, "Formation de niveau BAC") + assertContains(response, "Valider les informations") + + previous_last_checked_at = self.job_seeker.last_checked_at + + response = client.post(self.step_end_url) + assertRedirects( + response, + reverse( + self.FINAL_REDIRECT_VIEW_NAME, + kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id}, + ), + fetch_redirect_response=False, + ) + assert client.session.get(self.job_seeker_session_key) is None + + self.job_seeker.refresh_from_db() + assert self.job_seeker.has_jobseeker_profile is True + assert self.job_seeker.first_name == NEW_FIRST_NAME + assert self.job_seeker.address_line_1 == NEW_ADDRESS_LINE + self.job_seeker.jobseeker_profile.refresh_from_db() + assert self.job_seeker.jobseeker_profile.education_level == EducationLevel.BAC_LEVEL + + assert self.job_seeker.last_checked_at != previous_last_checked_at + def _check_only_administrative_allowed(self, client, user): client.force_login(user) @@ -3792,21 +4022,130 @@ def _check_only_administrative_allowed(self, client, user): assert self.job_seeker.jobseeker_profile.education_level == EducationLevel.BAC_LEVEL assert self.job_seeker.last_checked_at != previous_last_checked_at + def _check_only_administrative_allowed_deprecated(self, client, user): + client.force_login(user) + + # STEP 1 + response = client.get(self.step_1_url) + assertContains(response, self.job_seeker.first_name) + assertContains(response, self.INFO_MODIFIABLE_PAR_CANDIDAT_UNIQUEMENT) + + response = client.post(self.step_1_url) + assertRedirects(response, self.step_2_url, fetch_redirect_response=False) + + # Session is created + expected_job_seeker_session = {"user": {}} + assert client.session[self.job_seeker_session_key] == expected_job_seeker_session + + # STEP 2 + response = client.get(self.step_2_url) + assertContains(response, self.job_seeker.phone) + assertContains(response, self.INFO_MODIFIABLE_PAR_CANDIDAT_UNIQUEMENT) + + response = client.post(self.step_2_url) + assertRedirects(response, self.step_3_url, fetch_redirect_response=False) + + # Data is stored in the session but user is untouched + assert client.session[self.job_seeker_session_key] == expected_job_seeker_session + + # STEP 3 + response = client.get(self.step_3_url) + assertContains(response, "Niveau de formation") + + post_data = { + "education_level": EducationLevel.BAC_LEVEL.value, + } + response = client.post(self.step_3_url, data=post_data) + assertRedirects(response, self.step_end_url, fetch_redirect_response=False) + + # Data is stored in the session but user & profiles are untouched + expected_job_seeker_session["profile"] = post_data | { + "pole_emploi_id": "", + "lack_of_pole_emploi_id_reason": LackOfPoleEmploiId.REASON_NOT_REGISTERED, + "resourceless": False, + "rqth_employee": False, + "oeth_employee": False, + "pole_emploi": False, + "pole_emploi_id_forgotten": "", + "pole_emploi_since": "", + "unemployed": False, + "unemployed_since": "", + "rsa_allocation": False, + "has_rsa_allocation": RSAAllocation.NO.value, + "rsa_allocation_since": "", + "ass_allocation": False, + "ass_allocation_since": "", + "aah_allocation": False, + "aah_allocation_since": "", + } + assert client.session[self.job_seeker_session_key] == expected_job_seeker_session + self.job_seeker.refresh_from_db() + + # If you go back to step 3, new data is shown + response = client.get(self.step_3_url) + assertContains(response, '', html=True) + + # Step END + response = client.get(self.step_end_url) + assertContains(response, "Formation de niveau BAC") + + previous_last_checked_at = self.job_seeker.last_checked_at + + response = client.post(self.step_end_url) + assertRedirects( + response, + reverse( + self.FINAL_REDIRECT_VIEW_NAME, + kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id}, + ), + fetch_redirect_response=False, + ) + assert client.session.get(self.job_seeker_session_key) is None + + self.job_seeker.refresh_from_db() + assert self.job_seeker.has_jobseeker_profile is True + assert self.job_seeker.jobseeker_profile.education_level == EducationLevel.BAC_LEVEL + assert self.job_seeker.last_checked_at != previous_last_checked_at + class TestUpdateJobSeeker(UpdateJobSeekerTestMixin): - TUNNEL = "apply" + STEP_1_VIEW_NAME = "job_seekers_views:update_job_seeker_step_1" + STEP_2_VIEW_NAME = "job_seekers_views:update_job_seeker_step_2" + STEP_3_VIEW_NAME = "job_seekers_views:update_job_seeker_step_3" + STEP_END_VIEW_NAME = "job_seekers_views:update_job_seeker_step_end" FINAL_REDIRECT_VIEW_NAME = "apply:application_jobs" def test_anonymous_start(self, client): response = client.get(self.start_url) assertRedirects(response, reverse("account_login") + f"?next={quote(self.start_url)}") + # TODO(ewen): deprecated + def test_anonymous_step_1(self, client): + response = client.get(self.step_1_url) + assertRedirects(response, reverse("account_login") + f"?next={self.step_1_url}") + response = client.get(self.step_1_url) + assertRedirects(response, reverse("account_login") + f"?next={self.step_1_url}") + + def test_anonymous_step_2(self, client): + response = client.get(self.step_2_url) + assert response.status_code == 403 # because missing session + + def test_anonymous_step_3(self, client): + response = client.get(self.step_3_url) + assert response.status_code == 403 # because missing session + + def test_anonymous_step_end(self, client): + response = client.get(self.step_end_url) + assert response.status_code == 403 # because missing session + def test_as_job_seeker(self, client): self._check_nothing_permitted(client, self.job_seeker) + self._check_nothing_permitted_deprecated(client, self.job_seeker) def test_as_unauthorized_prescriber(self, client): prescriber = PrescriberOrganizationWithMembershipFactory(authorized=False).members.first() self._check_nothing_permitted(client, prescriber) + self._check_nothing_permitted_deprecated(client, prescriber) def test_as_unauthorized_prescriber_that_created_proxied_job_seeker(self, client, snapshot): prescriber = PrescriberOrganizationWithMembershipFactory(authorized=False).members.first() @@ -3827,6 +4166,25 @@ def test_as_unauthorized_prescriber_that_created_proxied_job_seeker(self, client }, ) + def test_as_unauthorized_prescriber_that_created_proxied_job_seeker_deprecated(self, client, snapshot): + prescriber = PrescriberOrganizationWithMembershipFactory(authorized=False).members.first() + self.job_seeker.created_by = prescriber + self.job_seeker.last_login = None + self.job_seeker.save(update_fields=["created_by", "last_login"]) + + geispolsheim = create_city_geispolsheim() + birthdate = self.job_seeker.jobseeker_profile.birthdate + + self._check_everything_allowed_deprecated( + client, + snapshot, + prescriber, + extra_post_data_1={ + "birth_place": Commune.objects.by_insee_code_and_period(geispolsheim.code_insee, birthdate).id, + "birth_country": Country.france_id, + }, + ) + def test_as_unauthorized_prescriber_that_created_the_non_proxied_job_seeker(self, client): prescriber = PrescriberOrganizationWithMembershipFactory(authorized=False).members.first() self.job_seeker.created_by = prescriber @@ -3834,6 +4192,7 @@ def test_as_unauthorized_prescriber_that_created_the_non_proxied_job_seeker(self self.job_seeker.last_login = timezone.now() - relativedelta(months=1) self.job_seeker.save(update_fields=["created_by", "last_login"]) self._check_nothing_permitted(client, prescriber) + self._check_nothing_permitted_deprecated(client, prescriber) def test_as_authorized_prescriber_with_proxied_job_seeker(self, client, snapshot): # Make sure the job seeker does not manage its own account @@ -3855,12 +4214,33 @@ def test_as_authorized_prescriber_with_proxied_job_seeker(self, client, snapshot }, ) + def test_as_authorized_prescriber_with_proxied_job_seeker_deprecated(self, client, snapshot): + # Make sure the job seeker does not manage its own account + self.job_seeker.created_by = PrescriberFactory() + self.job_seeker.last_login = None + self.job_seeker.save(update_fields=["created_by", "last_login"]) + authorized_prescriber = PrescriberOrganizationWithMembershipFactory(authorized=True).members.first() + + geispolsheim = create_city_geispolsheim() + birthdate = self.job_seeker.jobseeker_profile.birthdate + + self._check_everything_allowed_deprecated( + client, + snapshot, + authorized_prescriber, + extra_post_data_1={ + "birth_place": Commune.objects.by_insee_code_and_period(geispolsheim.code_insee, birthdate).id, + "birth_country": Country.france_id, + }, + ) + def test_as_authorized_prescriber_with_non_proxied_job_seeker(self, client): # Make sure the job seeker does manage its own account self.job_seeker.last_login = timezone.now() - relativedelta(months=1) self.job_seeker.save(update_fields=["last_login"]) authorized_prescriber = PrescriberOrganizationWithMembershipFactory(authorized=True).members.first() self._check_only_administrative_allowed(client, authorized_prescriber) + self._check_only_administrative_allowed_deprecated(client, authorized_prescriber) def test_as_company_with_proxied_job_seeker(self, client, snapshot): # Make sure the job seeker does not manage its own account @@ -3881,11 +4261,31 @@ def test_as_company_with_proxied_job_seeker(self, client, snapshot): }, ) + def test_as_company_with_proxied_job_seeker_deprecated(self, client, snapshot): + # Make sure the job seeker does not manage its own account + self.job_seeker.created_by = EmployerFactory() + self.job_seeker.last_login = None + self.job_seeker.save(update_fields=["created_by", "last_login"]) + + geispolsheim = create_city_geispolsheim() + birthdate = self.job_seeker.jobseeker_profile.birthdate + + self._check_everything_allowed_deprecated( + client, + snapshot, + self.company.members.first(), + extra_post_data_1={ + "birth_place": Commune.objects.by_insee_code_and_period(geispolsheim.code_insee, birthdate).id, + "birth_country": Country.france_id, + }, + ) + def test_as_company_with_non_proxied_job_seeker(self, client): # Make sure the job seeker does manage its own account self.job_seeker.last_login = timezone.now() - relativedelta(months=1) self.job_seeker.save(update_fields=["last_login"]) self._check_only_administrative_allowed(client, self.company.members.first()) + self._check_only_administrative_allowed_deprecated(client, self.company.members.first()) def test_with_invalid_job_seeker_session(self, client): client.force_login(self.company.members.first()) @@ -3900,6 +4300,15 @@ def test_with_invalid_job_seeker_session(self, client): response = client.get(url) assert response.status_code == 404 + # TODO(ewen): deprecated + for url in [ + self.step_2_url, + self.step_3_url, + self.step_end_url, + ]: + response = client.get(url) + assert response.status_code == 403 + def test_with_job_seeker_without_nir(self, client, snapshot): # Make sure the job seeker does not manage its own account (and has no nir) self.job_seeker.jobseeker_profile.nir = "" @@ -3928,28 +4337,81 @@ def test_with_job_seeker_without_nir(self, client, snapshot): # Check that we could update its NIR infos assert self.job_seeker.jobseeker_profile.lack_of_nir_reason == LackOfNIRReason.TEMPORARY_NUMBER + def test_with_job_seeker_without_nir_deprecated(self, client, snapshot): + # Make sure the job seeker does not manage its own account (and has no nir) + self.job_seeker.jobseeker_profile.nir = "" + self.job_seeker.jobseeker_profile.lack_of_nir_reason = "" + self.job_seeker.jobseeker_profile.save(update_fields=["nir", "lack_of_nir_reason"]) + + self.job_seeker.created_by = EmployerFactory() + self.job_seeker.last_login = None + self.job_seeker.save(update_fields=["created_by", "last_login"]) + + geispolsheim = create_city_geispolsheim() + birthdate = self.job_seeker.jobseeker_profile.birthdate + + self._check_everything_allowed_deprecated( + client, + snapshot, + self.company.members.first(), + extra_post_data_1={ + "nir": "", + "lack_of_nir": True, + "lack_of_nir_reason": LackOfNIRReason.TEMPORARY_NUMBER.value, + "birth_place": Commune.objects.by_insee_code_and_period(geispolsheim.code_insee, birthdate).id, + "birth_country": Country.france_id, + }, + ) + # Check that we could update its NIR infos + assert self.job_seeker.jobseeker_profile.lack_of_nir_reason == LackOfNIRReason.TEMPORARY_NUMBER + def test_as_company_that_last_step_doesnt_crash_with_direct_access(self, client): # Make sure the job seeker does not manage its own account self.job_seeker.created_by = EmployerFactory() self.job_seeker.last_login = None self.job_seeker.save(update_fields=["created_by", "last_login"]) self._check_that_last_step_doesnt_crash_with_direct_access(client, self.company.members.first()) + self._check_that_last_step_doesnt_crash_with_direct_access_deprecated(client, self.company.members.first()) class TestUpdateJobSeekerForHire(UpdateJobSeekerTestMixin): - TUNNEL = "hire" + STEP_1_VIEW_NAME = "job_seekers_views:update_job_seeker_step_1_for_hire" + STEP_2_VIEW_NAME = "job_seekers_views:update_job_seeker_step_2_for_hire" + STEP_3_VIEW_NAME = "job_seekers_views:update_job_seeker_step_3_for_hire" + STEP_END_VIEW_NAME = "job_seekers_views:update_job_seeker_step_end_for_hire" FINAL_REDIRECT_VIEW_NAME = "job_seekers_views:check_job_seeker_info_for_hire" def test_anonymous_start(self, client): response = client.get(self.start_url) assertRedirects(response, reverse("account_login") + f"?next={quote(self.start_url)}") + # TODO(ewen): deprecated + def test_anonymous_step_1(self, client): + response = client.get(self.step_1_url) + assertRedirects(response, reverse("account_login") + f"?next={self.step_1_url}") + response = client.get(self.step_1_url) + assertRedirects(response, reverse("account_login") + f"?next={self.step_1_url}") + + def test_anonymous_step_2(self, client): + response = client.get(self.step_2_url) + assert response.status_code == 403 # because missing session + + def test_anonymous_step_3(self, client): + response = client.get(self.step_3_url) + assert response.status_code == 403 # because missing session + + def test_anonymous_step_end(self, client): + response = client.get(self.step_end_url) + assert response.status_code == 403 # because missing session + def test_as_job_seeker(self, client): self._check_nothing_permitted(client, self.job_seeker) + self._check_nothing_permitted_deprecated(client, self.job_seeker) def test_as_unauthorized_prescriber(self, client): prescriber = PrescriberOrganizationWithMembershipFactory(authorized=False).members.first() self._check_nothing_permitted(client, prescriber) + self._check_nothing_permitted_deprecated(client, prescriber) def test_as_unauthorized_prescriber_that_created_proxied_job_seeker(self, client, snapshot): prescriber = PrescriberOrganizationWithMembershipFactory(authorized=False).members.first() @@ -3969,6 +4431,7 @@ def test_as_unauthorized_prescriber_that_created_proxied_job_seeker(self, client "birth_country": Country.france_id, }, ) + self._check_nothing_permitted_deprecated(client, prescriber) def test_as_unauthorized_prescriber_that_created_the_non_proxied_job_seeker(self, client): prescriber = PrescriberOrganizationWithMembershipFactory(authorized=False).members.first() @@ -3977,6 +4440,7 @@ def test_as_unauthorized_prescriber_that_created_the_non_proxied_job_seeker(self self.job_seeker.last_login = timezone.now() - relativedelta(months=1) self.job_seeker.save(update_fields=["created_by", "last_login"]) self._check_nothing_permitted(client, prescriber) + self._check_nothing_permitted_deprecated(client, prescriber) def test_as_authorized_prescriber_with_proxied_job_seeker(self, client, snapshot): # Make sure the job seeker does not manage its own account @@ -3997,6 +4461,7 @@ def test_as_authorized_prescriber_with_proxied_job_seeker(self, client, snapshot "birth_country": Country.france_id, }, ) + self._check_nothing_permitted_deprecated(client, authorized_prescriber) def test_as_authorized_prescriber_with_non_proxied_job_seeker(self, client): # Make sure the job seeker does manage its own account @@ -4004,6 +4469,7 @@ def test_as_authorized_prescriber_with_non_proxied_job_seeker(self, client): self.job_seeker.save(update_fields=["last_login"]) authorized_prescriber = PrescriberOrganizationWithMembershipFactory(authorized=True).members.first() self._check_only_administrative_allowed(client, authorized_prescriber) + self._check_nothing_permitted_deprecated(client, authorized_prescriber) def test_as_company_with_proxied_job_seeker(self, client, snapshot): # Make sure the job seeker does not manage its own account @@ -4024,11 +4490,31 @@ def test_as_company_with_proxied_job_seeker(self, client, snapshot): }, ) + def test_as_company_with_proxied_job_seeker_deprecated(self, client, snapshot): + # Make sure the job seeker does not manage its own account + self.job_seeker.created_by = EmployerFactory() + self.job_seeker.last_login = None + self.job_seeker.save(update_fields=["created_by", "last_login"]) + + geispolsheim = create_city_geispolsheim() + birthdate = self.job_seeker.jobseeker_profile.birthdate + + self._check_everything_allowed_deprecated( + client, + snapshot, + self.company.members.first(), + extra_post_data_1={ + "birth_place": Commune.objects.by_insee_code_and_period(geispolsheim.code_insee, birthdate).id, + "birth_country": Country.france_id, + }, + ) + def test_as_company_with_non_proxied_job_seeker(self, client): # Make sure the job seeker does manage its own account self.job_seeker.last_login = timezone.now() - relativedelta(months=1) self.job_seeker.save(update_fields=["last_login"]) self._check_only_administrative_allowed(client, self.company.members.first()) + self._check_only_administrative_allowed_deprecated(client, self.company.members.first()) def test_with_invalid_job_seeker_session(self, client): client.force_login(self.company.members.first()) @@ -4043,6 +4529,15 @@ def test_with_invalid_job_seeker_session(self, client): response = client.get(url) assert response.status_code == 404 + # TODO(ewen): deprecated + for url in [ + self.step_2_url, + self.step_3_url, + self.step_end_url, + ]: + response = client.get(url) + assert response.status_code == 403 + def test_with_job_seeker_without_nir(self, client, snapshot): # Make sure the job seeker does not manage its own account (and has no nir) self.job_seeker.jobseeker_profile.nir = "" @@ -4071,12 +4566,41 @@ def test_with_job_seeker_without_nir(self, client, snapshot): # Check that we could update its NIR infos assert self.job_seeker.jobseeker_profile.lack_of_nir_reason == LackOfNIRReason.TEMPORARY_NUMBER + def test_with_job_seeker_without_nir_deprecated(self, client, snapshot): + # Make sure the job seeker does not manage its own account (and has no nir) + self.job_seeker.jobseeker_profile.nir = "" + self.job_seeker.jobseeker_profile.lack_of_nir_reason = "" + self.job_seeker.jobseeker_profile.save(update_fields=["nir", "lack_of_nir_reason"]) + + self.job_seeker.created_by = EmployerFactory() + self.job_seeker.last_login = None + self.job_seeker.save(update_fields=["created_by", "last_login"]) + + geispolsheim = create_city_geispolsheim() + birthdate = self.job_seeker.jobseeker_profile.birthdate + + self._check_everything_allowed_deprecated( + client, + snapshot, + self.company.members.first(), + extra_post_data_1={ + "nir": "", + "lack_of_nir": True, + "lack_of_nir_reason": LackOfNIRReason.TEMPORARY_NUMBER.value, + "birth_place": Commune.objects.by_insee_code_and_period(geispolsheim.code_insee, birthdate).id, + "birth_country": Country.france_id, + }, + ) + # Check that we could update its NIR infos + assert self.job_seeker.jobseeker_profile.lack_of_nir_reason == LackOfNIRReason.TEMPORARY_NUMBER + def test_as_company_that_last_step_doesnt_crash_with_direct_access(self, client): # Make sure the job seeker does not manage its own account self.job_seeker.created_by = EmployerFactory() self.job_seeker.last_login = None self.job_seeker.save(update_fields=["created_by", "last_login"]) self._check_that_last_step_doesnt_crash_with_direct_access(client, self.company.members.first()) + self._check_that_last_step_doesnt_crash_with_direct_access_deprecated(client, self.company.members.first()) class TestUpdateJobSeekerStep3View: @@ -4118,6 +4642,29 @@ def test_job_seeker_with_profile_has_check_boxes_ticked_in_step3(self, client): html=True, ) + # TODO(ewen): Deprecated + # STEP 1 to setup jobseeker session + response = client.get( + reverse( + "job_seekers_views:update_job_seeker_step_1", + kwargs={"company_pk": company.pk, "job_seeker_public_id": job_seeker.public_id}, + ) + ) + assert response.status_code == 200 + + # Go straight to STEP 3 + response = client.get( + reverse( + "job_seekers_views:update_job_seeker_step_3", + kwargs={"company_pk": company.pk, "job_seeker_public_id": job_seeker.public_id}, + ) + ) + assertContains( + response, + '', + html=True, + ) + @pytest.mark.ignore_unknown_variable_template_error("confirmation_needed", "job_seeker") def test_detect_existing_job_seeker(client):