This commit is contained in:
@@ -177,7 +177,20 @@ def test_job_profile_source_and_application_views(client, user, profile, job, so
|
||||
|
||||
@pytest.mark.integration
|
||||
@pytest.mark.django_db
|
||||
def test_sources_candidate_bulk_actions_and_evidence_view(client, user):
|
||||
def test_sources_candidate_bulk_actions_and_evidence_view(client, user, profile):
|
||||
profile.home_postal_code = "2400"
|
||||
profile.max_distance_km = 40
|
||||
profile.home_latitude = None
|
||||
profile.home_longitude = None
|
||||
profile.save(
|
||||
update_fields=[
|
||||
"home_postal_code",
|
||||
"max_distance_km",
|
||||
"home_latitude",
|
||||
"home_longitude",
|
||||
"updated_at",
|
||||
]
|
||||
)
|
||||
candidate = Source.objects.create(
|
||||
name="Discoverd candidate",
|
||||
source_type=Source.Type.EMPLOYER,
|
||||
@@ -206,12 +219,37 @@ def test_sources_candidate_bulk_actions_and_evidence_view(client, user):
|
||||
status=Source.Status.CANDIDATE,
|
||||
policy=Source.Policy.REVIEW,
|
||||
)
|
||||
watchlist = Source.objects.create(
|
||||
name="Interessante werkgever zonder stabiele feed",
|
||||
source_type=Source.Type.EMPLOYER,
|
||||
base_url="https://watch.example.org/jobs/",
|
||||
domain="watch.example.org",
|
||||
status=Source.Status.PAUSED,
|
||||
policy=Source.Policy.REVIEW,
|
||||
metadata={
|
||||
"watchlist": True,
|
||||
"municipality_scope": "Olen",
|
||||
"watchlist_reason": "Regionaal interessante werkgever",
|
||||
"current_observation": "Momenteel geen lokale vacature bevestigd.",
|
||||
"public_job_page": "https://watch.example.org/jobs/",
|
||||
},
|
||||
)
|
||||
|
||||
client.force_login(user)
|
||||
response = client.get(reverse("sources:list"))
|
||||
assert response.status_code == 200
|
||||
content = response.content.decode("utf-8")
|
||||
assert "jobs.example.org/careers" in content
|
||||
assert "Platformmailboxen" in content
|
||||
assert "Mailbox koppelen en testen" in content
|
||||
assert "elke vijf minuten" in content
|
||||
assert "2400 Mol" in content
|
||||
assert "maximaal 40 km" in content
|
||||
assert "Coördinaten ontbreken nog" in content
|
||||
assert "Interessante werkgeverswaaklijst" in content
|
||||
assert watchlist.name in content
|
||||
assert response.context["watchlist_count"] == 1
|
||||
assert {item.pk for item in response.context["sources"]} == {candidate.pk, other.pk}
|
||||
|
||||
response = client.post(
|
||||
reverse("sources:bulk"),
|
||||
@@ -229,3 +267,12 @@ def test_sources_candidate_bulk_actions_and_evidence_view(client, user):
|
||||
other.refresh_from_db()
|
||||
assert other.status == Source.Status.DISABLED
|
||||
assert other.policy == Source.Policy.DENY
|
||||
|
||||
response = client.post(
|
||||
reverse("sources:bulk"),
|
||||
{"action": "dismiss", "source_ids": [str(watchlist.pk)]},
|
||||
)
|
||||
assert response.status_code == 302
|
||||
watchlist.refresh_from_db()
|
||||
assert watchlist.status == Source.Status.PAUSED
|
||||
assert watchlist.policy == Source.Policy.REVIEW
|
||||
|
||||
Reference in New Issue
Block a user