コード例 #1
0
ファイル: test_api_spec.py プロジェクト: e2000y/FlowKit
def test_generated_openapi_json_spec(flowapi_url, diff_reporter):
    """
    Verify the OpenAPI spec for FlowAPI.
    """
    spec = requests.get(f"{flowapi_url}/api/0/spec/openapi.json").json()
    spec_version = spec["info"].pop("version")
    assert spec_version == flowapi.__version__
    spec_as_json_string = json.dumps(sort_recursively(spec),
                                     indent=2,
                                     sort_keys=True)
    diff_reporter(spec_as_json_string)
コード例 #2
0
def test_generated_openapi_yaml_spec(flowapi_url, diff_reporter):
    """
    Verify the OpenAPI spec for FlowAPI in yaml form.
    """
    spec = yaml.load(
        requests.get(f"{flowapi_url}/api/0/spec/openapi.yaml").content)
    spec_version = spec["info"].pop("version")
    assert spec_version == flowapi.__version__
    spec_as_json_string = json.dumps(sort_recursively(spec),
                                     indent=2,
                                     sort_keys=True)
    verify(spec_as_json_string, diff_reporter)
コード例 #3
0
ファイル: test_server.py プロジェクト: vishalbelsare/FlowKit
def test_api_spec_of_flowmachine_query_schemas(zmq_host, zmq_port, diff_reporter):
    """
    Verify the API spec for flowmachine queries.
    """
    msg = {"action": "get_query_schemas", "request_id": "DUMMY_ID"}
    reply = send_zmq_message_and_receive_reply(msg, port=zmq_port, host=zmq_host)
    print(reply)
    assert "success" == reply["status"]
    spec_as_json_string = json.dumps(
        sort_recursively(reply["payload"]["query_schemas"]), indent=2
    )
    diff_reporter(spec_as_json_string)
コード例 #4
0
ファイル: test_utils.py プロジェクト: sourcery-ai-bot/FlowKit
def test_sort_recursively():
    """
    Test that `sort_recursively` recursively sorts all components of the input dictionary.
    """
    d = {
        "cc": {
            "foo": 23,
            "bar": 42
        },
        "aa": [("quux2", 100), ("quux1", 200)],
        "bb": "hello",
    }
    d_sorted_expected = {
        "aa": [("quux1", 200), ("quux2", 100)],
        "bb": "hello",
        "cc": {
            "bar": 42,
            "foo": 23
        },
    }

    assert d_sorted_expected == sort_recursively(d)