-
Andrew Kapuscinski authoredAndrew Kapuscinski authored
test_json.py 858 B
import pendulum
import pytest
from workspaces.workflow.enum import WorkflowEventType
from workspaces.workflow.json import WorkflowEventSchema
from workspaces.workflow.schema import WorkflowEvent
@pytest.mark.skip(
reason="This is testing the entire WF event system, not a single module of that system; therefore, it's an integration test"
)
def test_schema_dumpload():
"""
Tests that a WorflowEvent can be created, dumped to JSON, and loaded into a schema without losing any information
"""
e = WorkflowEvent(
workflow_request_id=0,
job_name="foo",
condor_job_id=1,
event_type=WorkflowEventType.SUBMITTED,
timestamp=str(pendulum.now()),
log="nothing to speak of",
)
schema = WorkflowEventSchema()
event_text = schema.dump(e)
r = schema.load(event_text)
assert e == r