Exemplo n.º 1
0
def test_serialize_local_environment():
    env = environments.LocalEnvironment(encryption_key=FERNET_KEY)
    serialized = LocalEnvironmentSchema().dump(env)
    assert (
        serialized["encryption_key"]
        == "MWNyZGVyVEhWSjd2dlZKajc5Wm5zODFfMW9wYVRJRDBIUlpvT3pxSXBPQT0="
    )
    assert serialized["__version__"] == prefect.__version__
Exemplo n.º 2
0
def test_serialize_local_environment_with_labels():
    env = environments.LocalEnvironment(labels=["bob", "alice"])

    schema = RemoteEnvironmentSchema()
    serialized = schema.dump(env)
    assert serialized
    assert serialized["__version__"] == prefect.__version__
    assert set(serialized["labels"]) == set(["bob", "alice"])

    new = schema.load(serialized)
    assert new.labels == set(["bob", "alice"])
Exemplo n.º 3
0
def test_serialize_local_environment_with_labels():
    env = environments.LocalEnvironment(labels=["b", "c", "a"])

    schema = LocalEnvironmentSchema()
    serialized = schema.dump(env)
    assert serialized
    assert serialized["__version__"] == prefect.__version__
    # labels should be sorted in the serialized obj
    assert serialized["labels"] == ["a", "b", "c"]

    new = schema.load(serialized)
    assert new.labels == {"b", "c", "a"}
Exemplo n.º 4
0
def test_environment_schema_with_local_environment():
    env = environments.LocalEnvironment(encryption_key=FERNET_KEY)
    serialized = EnvironmentSchema().dump(env)
    deserialized = EnvironmentSchema().load(serialized)
    assert isinstance(deserialized, environments.LocalEnvironment)
    assert deserialized.encryption_key == FERNET_KEY