Exemple #1
0
def test_local_result_doesnt_validate_on_deserialization():
    schema = StateResultSchema()
    result = results.LocalResult(validate_dir=True)
    serialized = schema.dump(result)

    assert serialized["type"] == "LocalResult"
    serialized["dir"] = r"C:\Windows\paths\are\weird"

    new_result = schema.load(serialized)
    assert isinstance(new_result, results.LocalResult)
    assert new_result.dir == r"C:\Windows\paths\are\weird"
Exemple #2
0
def test_local_result():
    schema = StateResultSchema()
    result = results.LocalResult(value=42, location="bar")
    serialized = schema.dump(result)

    assert serialized["type"] == "LocalResult"
    assert serialized["dir"] is not None
    assert serialized["location"] == "bar"

    new_result = schema.load(serialized)
    assert isinstance(new_result, results.LocalResult)
    assert new_result.dir == result.dir
    assert new_result.location == "bar"
    assert new_result.value is None