def stored_job(job_id, job_def, job_status, job_data_ids, job_data_meta):
    ctime = dt.datetime(2020, 12, 11, 19, 52, tzinfo=dt.timezone.utc)
    job_data_meta_0 = models.StoredJobDataMetadata(
        object_id=job_data_ids[0],
        object_type="job_data",
        created_at=ctime,
        modified_at=ctime,
        definition=models.JobDataMetadata(
            schema_path="/inverters/0/arrays/0",
            type="actual weather data",
            filename="",
            data_columns=[
                "time",
                "poa_global",
                "poa_direct",
                "poa_diffuse",
                "module_temperature",
            ],
        ),
    )
    job_data_meta_1 = job_data_meta
    return models.StoredJob(
        definition=job_def,
        status=job_status,
        data_objects=[job_data_meta_0, job_data_meta_1],
        object_id=job_id,
        object_type="job",
        created_at=ctime,
        modified_at=ctime,
    )
def test_get_job(client, stored_job, job_id):
    response = client.get(f"/jobs/{job_id}")
    assert response.status_code == 200
    assert models.StoredJob(**response.json()) == stored_job
def test_list_jobs(client, stored_job):
    response = client.get("/jobs")
    jobs = [models.StoredJob(**j) for j in response.json()]
    assert response.status_code == 200
    assert len(jobs) == 5
    assert jobs[0] == stored_job