def test_serialize_deserialize(serializer: Serializer, schedule: DateSchedule):
    if isinstance(serializer, CustomizableSerializer):
        serializer.register_custom_type(DateSchedule)

    payload = serializer.serialize(schedule)
    deserialized = serializer.deserialize(payload)

    assert deserialized.run_time == schedule.run_time
    assert deserialized.timezone == schedule.timezone
    assert deserialized.args == schedule.args
    assert deserialized.kwargs == schedule.kwargs
    assert deserialized.misfire_grace_time == schedule.misfire_grace_time
Ejemplo n.º 2
0
def test_serialize_deserialize(serializer: Serializer, schedule: CronSchedule):
    if isinstance(serializer, CustomizableSerializer):
        serializer.register_custom_type(CronSchedule)

    payload = serializer.serialize(schedule)
    deserialized = serializer.deserialize(payload)

    assert deserialized.start_time == schedule.start_time
    assert deserialized.end_time == schedule.end_time
    assert deserialized.fields == schedule.fields
    assert deserialized.timezone == schedule.timezone
    assert deserialized.args == schedule.args
    assert deserialized.kwargs == schedule.kwargs
    assert deserialized.misfire_grace_time == schedule.misfire_grace_time
def test_serialize_deserialize(serializer: Serializer, schedule: CronSchedule):
    if isinstance(serializer, CustomizableSerializer):
        serializer.register_custom_type(CronSchedule)

    payload = serializer.serialize(schedule)
    deserialized = serializer.deserialize(payload)

    assert deserialized.start_time == schedule.start_time
    assert deserialized.end_time == schedule.end_time
    assert deserialized.fields == schedule.fields
    assert deserialized.timezone == schedule.timezone
    assert deserialized.args == schedule.args
    assert deserialized.kwargs == schedule.kwargs
    assert deserialized.misfire_grace_time == schedule.misfire_grace_time
def test_serialize_deserialize(serializer: Serializer, schedule: CalendarIntervalSchedule):
    if isinstance(serializer, CustomizableSerializer):
        serializer.register_custom_type(CalendarIntervalSchedule)

    payload = serializer.serialize(schedule)
    deserialized = serializer.deserialize(payload)

    assert deserialized.years == schedule.years
    assert deserialized.months == schedule.months
    assert deserialized.weeks == schedule.weeks
    assert deserialized.days == schedule.days
    assert deserialized.time == schedule.time
    assert deserialized.start_date == schedule.start_date
    assert deserialized.end_date == schedule.end_date
    assert deserialized.timezone == schedule.timezone
    assert deserialized.args == schedule.args
    assert deserialized.kwargs == schedule.kwargs
    assert deserialized.misfire_grace_time == schedule.misfire_grace_time