35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
from job_research.models import ApecListing, ApecRunMeta, ListingWarning
|
|
|
|
|
|
def test_apec_models_serialize_expected_listing_shape() -> None:
|
|
listing = ApecListing(
|
|
source="apec",
|
|
source_job_id="123",
|
|
url="https://example.test/job/123",
|
|
title="Data Engineer",
|
|
company="Example",
|
|
location="Paris",
|
|
contract_type="CDI",
|
|
description_text="Build pipelines",
|
|
published_at="2026-06-01",
|
|
fetched_at="2026-06-01T10:00:00Z",
|
|
warnings=[
|
|
ListingWarning(
|
|
field="location",
|
|
message="Location inferred from page text",
|
|
)
|
|
],
|
|
)
|
|
run_meta = ApecRunMeta(
|
|
derived_queries=["Data Engineer"],
|
|
fetched_count=1,
|
|
normalized_count=1,
|
|
deduplicated_count=1,
|
|
failed_count=0,
|
|
listing_errors=[],
|
|
)
|
|
|
|
assert listing.model_dump()["source"] == "apec"
|
|
assert listing.model_dump()["warnings"][0]["field"] == "location"
|
|
assert run_meta.model_dump()["derived_queries"] == ["Data Engineer"]
|