summaryrefslogtreecommitdiff
path: root/tests/test_serializers.py
blob: 28f691d6039b8e7b7da96df7b0790cafcf2f09c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from __future__ import annotations

from uuid import uuid4

import pytest

from apscheduler import Event, JobAdded
from apscheduler.abc import Serializer


@pytest.mark.parametrize(
    "event",
    [
        pytest.param(
            JobAdded(
                job_id=uuid4(),
                task_id="task",
                schedule_id="schedule",
                tags=["tag1", "tag2"],
            ),
            id="job_added",
        )
    ],
)
def test_serialize_event(event: Event, serializer: Serializer) -> None:
    payload = serializer.serialize(event.marshal(serializer))
    deserialized = type(event).unmarshal(serializer, serializer.deserialize(payload))
    assert deserialized == event