Exemplo n.º 1
0
def test_verify_task_schema(tmpdir):
    """``verify_task_schema`` raises if the task doesn't match the schema."""
    path = os.path.join(tmpdir, "schema.json")
    with open(path, "w") as fh:
        fh.write(json.dumps(FAKE_SCHEMA))
    config = {"foo": {"bar": path}}
    client.verify_task_schema(config, {"list-of-strings": ["a"]}, "foo.bar")
    with pytest.raises(TaskVerificationError):
        client.verify_task_schema(config, {"list-of-strings": ["a", "a"]},
                                  "foo.bar")
    with pytest.raises(TaskVerificationError):
        client.verify_task_schema(config, {"list-of-strings": ["a", "a"]},
                                  "nonexistent_path")
Exemplo n.º 2
0
def test_tag_info_invalid(config, task_defn, tag_info):
    task = task_defn
    task["payload"]["tag_info"] = tag_info
    with pytest.raises(TaskVerificationError):
        verify_task_schema(config, task)
Exemplo n.º 3
0
def test_missing_mandatory_urls_are_reported(config, task_defn):
    del task_defn["scopes"]

    with pytest.raises(TaskVerificationError):
        verify_task_schema(config, task_defn)
Exemplo n.º 4
0
def test_no_error_is_reported_when_no_missing_url(config, task_defn):
    verify_task_schema(config, task_defn)