89 lines
2.8 KiB
Python
89 lines
2.8 KiB
Python
import pytest
|
|
from django.urls import reverse
|
|
|
|
from apps.jobs.models import JobPosting, ScoreRun
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.django_db
|
|
def test_skill_insights_require_login(client):
|
|
response = client.get(reverse("jobs:skill-insights"))
|
|
|
|
assert response.status_code == 302
|
|
assert reverse("login") in response.url
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.django_db
|
|
def test_skill_insights_use_current_profile_and_exclude_hidden_jobs(client, user, profile, job):
|
|
job.skills_required = ["Microsoft 365"]
|
|
job.description_text = "Microsoft 365, Dynamics 365 en Microsoft Copilot governance."
|
|
job.save(update_fields=["skills_required", "description_text"])
|
|
ScoreRun.objects.create(
|
|
job=job,
|
|
profile=profile,
|
|
profile_version=profile.version,
|
|
score=74,
|
|
confidence=0.9,
|
|
recommendation=ScoreRun.Recommendation.POSSIBLE,
|
|
)
|
|
hidden = JobPosting.objects.create(
|
|
employer=job.employer,
|
|
original_title="Network Engineer buiten bereik",
|
|
normalized_title="network engineer buiten bereik",
|
|
canonical_url="https://jobs.example.org/vacatures/network-hidden",
|
|
canonical_key="1" * 64,
|
|
content_hash="2" * 64,
|
|
description_text="Beheer FortiGate-firewalls.",
|
|
status=JobPosting.Status.ACTIVE,
|
|
)
|
|
ScoreRun.objects.create(
|
|
job=hidden,
|
|
profile=profile,
|
|
profile_version=profile.version,
|
|
score=80,
|
|
confidence=0.9,
|
|
recommendation=ScoreRun.Recommendation.HIDDEN,
|
|
hard_exclusions=["Buiten de zoekradius."],
|
|
)
|
|
client.force_login(user)
|
|
|
|
response = client.get(reverse("jobs:skill-insights"))
|
|
body = response.content.decode()
|
|
|
|
assert response.status_code == 200
|
|
assert "Skillsradar" in body
|
|
assert "Microsoft 365" in body
|
|
assert "Microsoft Dynamics 365" in body
|
|
assert "Microsoft Copilot" in body
|
|
assert "Fortinet / FortiGate" not in body
|
|
assert "Ervaringsjaren tellen nergens mee" in body
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.django_db
|
|
def test_skill_insights_offer_category_and_gap_filters(client, user, profile, job):
|
|
job.skills_required = ["Microsoft 365", "FortiGate"]
|
|
job.description_text = "Microsoft 365 en FortiGate-beheer."
|
|
job.save(update_fields=["skills_required", "description_text"])
|
|
ScoreRun.objects.create(
|
|
job=job,
|
|
profile=profile,
|
|
profile_version=profile.version,
|
|
score=74,
|
|
confidence=0.9,
|
|
recommendation=ScoreRun.Recommendation.POSSIBLE,
|
|
)
|
|
client.force_login(user)
|
|
|
|
response = client.get(
|
|
reverse("jobs:skill-insights"),
|
|
{"category": "netwerk-security", "coverage": "gap"},
|
|
)
|
|
body = response.content.decode()
|
|
|
|
assert response.status_code == 200
|
|
assert "Fortinet / FortiGate" in body
|
|
assert "Microsoft 365" not in body
|
|
assert "Leerkans" in body
|