Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Candidatures : Masquer le bouton « Modifier » des fiches de poste lors du transfert vers un métier de sa structure [GEN-2005] #5046

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions itou/www/apply/views/process_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ def get_context_data(self, **kwargs):
return data | {
"job_app_to_transfer": self.job_application,
"matomo_custom_title": data["matomo_custom_title"] + " (transfert)",
"can_update_job_description": False,
}


Expand Down
35 changes: 32 additions & 3 deletions tests/www/apply/test_process_external_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from tests.job_applications.factories import JobApplicationFactory
from tests.jobs.factories import create_test_romes_and_appellations
from tests.utils.test import parse_response_to_soup
from tests.www.companies_views.test_job_description_views import POSTULER


INTERNAL_TRANSFER_CONFIRM_BUTTON = """
Expand Down Expand Up @@ -96,7 +97,7 @@ def test_step_1(client, snapshot):
)
assertContains(response, other_company.name.capitalize())
assertContains(response, job_application.to_company.name.capitalize())
assertNotContains(response, "Postuler")
assertNotContains(response, POSTULER)
assertContains(
response,
"<span>Transférer la candidature</span>",
Expand Down Expand Up @@ -141,7 +142,7 @@ def test_step_1(client, snapshot):
count=2,
)
assertContains(response, job_card_url, count=1)
assertNotContains(response, "Postuler")
assertNotContains(response, POSTULER)
assertContains(
response,
"<span>Transférer la candidature</span>",
Expand All @@ -157,14 +158,42 @@ def test_step_1(client, snapshot):
count=1,
)
assertContains(response, company_card_url, count=1)
assertNotContains(response, "Postuler")
assertNotContains(response, POSTULER)
assertContains(
response,
"<span>Transférer la candidature</span>",
count=1,
)


def test_step_1_same_company(client):
create_test_romes_and_appellations(["N1101"], appellations_per_rome=1)
vannes = create_city_vannes()
company = CompanyFactory(coords=vannes.coords, post_code="56760", with_membership=True)
job = JobDescriptionFactory(company=company)

job_application = JobApplicationFactory(state=JobApplicationState.REFUSED, to_company=company)
employer = job_application.to_company.members.get()
client.force_login(employer)

response = client.get(
reverse(
"apply:job_application_external_transfer_step_1_job_description_card",
kwargs={"job_application_id": job_application.pk, "job_description_id": job.pk},
)
)
assertNotContains(response, POSTULER)
assertContains(
response,
"<span>Transférer la candidature</span>",
count=1,
)
assertNotContains(
response,
reverse("companies_views:update_job_description", kwargs={"job_description_id": job.pk}),
)


def test_step_2_same_company(client):
job_application = JobApplicationFactory(state=JobApplicationState.REFUSED, for_snapshot=True)
company = job_application.to_company
Expand Down
9 changes: 6 additions & 3 deletions tests/www/companies_views/test_job_description_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
from tests.utils.test import assertSnapshotQueries


POSTULER = "Postuler"


class JobDescriptionAbstract:
@pytest.fixture(autouse=True)
def abstract_setup_method(self):
Expand Down Expand Up @@ -608,7 +611,7 @@ def test_prescriber_card_actions(self, client, snapshot):
with assertSnapshotQueries(snapshot):
response = client.get(self.url)

assertContains(response, "Postuler auprès de l'employeur inclusif")
assertContains(response, f"{POSTULER} auprès de l'employeur inclusif")
assertContains(response, self.apply_start_url(self.company))
assertNotContains(
response,
Expand All @@ -621,14 +624,14 @@ def test_job_seeker_card_actions(self, client, snapshot):
with assertSnapshotQueries(snapshot):
response = client.get(self.url)

assertContains(response, "Postuler auprès de l'employeur inclusif")
assertContains(response, f"{POSTULER} auprès de l'employeur inclusif")
assertContains(response, self.apply_start_url(self.company))
assertNotContains(response, self.update_job_description_url(self.job_description))

def test_anonymous_card_actions(self, client):
response = client.get(self.url)

assertContains(response, "Postuler auprès de l'employeur inclusif")
assertContains(response, f"{POSTULER} auprès de l'employeur inclusif")
assertContains(response, self.apply_start_url(self.company))
assertNotContains(response, self.update_job_description_url(self.job_description))

Expand Down
Loading