mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
Working tests
This commit is contained in:
@@ -17,13 +17,14 @@ def run_test(test_type: str, check_function) -> None:
|
||||
assert not missing_items, "\n".join(missing_items)
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs uvicorn to be launched but shouldn't be the case.")
|
||||
# TODO: Check if this can work without being an integration test
|
||||
@pytest.mark.integration
|
||||
def test_api_interface_integration_test_providers() -> None:
|
||||
"""Test if there are any missing providers for integration tests."""
|
||||
run_test("api", check_missing_integration_test_providers)
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs uvicorn to be launched but shouldn't be the case.")
|
||||
@pytest.mark.integration
|
||||
def test_api_interface_integration_test_params() -> None:
|
||||
"""Test if there are any missing params for integration tests."""
|
||||
run_test("api", check_missing_integration_test_params)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
"""Test the integration tests."""
|
||||
import pytest
|
||||
from extensions.tests.utils.integration_tests_testers import (
|
||||
check_missing_integration_test_params,
|
||||
check_missing_integration_test_providers,
|
||||
@@ -16,11 +17,14 @@ def run_test(test_type: str, check_function) -> None:
|
||||
assert not missing_items, "\n".join(missing_items)
|
||||
|
||||
|
||||
# TODO: Check if this can work without being an integration test
|
||||
@pytest.mark.integration
|
||||
def test_python_interface_integration_test_providers() -> None:
|
||||
"""Test if there are any missing providers for integration tests."""
|
||||
run_test("python", check_missing_integration_test_providers)
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_python_interface_integration_test_params() -> None:
|
||||
"""Test if there are any missing params for integration tests."""
|
||||
run_test("python", check_missing_integration_test_params)
|
||||
|
||||
@@ -132,7 +132,7 @@ def write_integration_tests(
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
r = requests.get("http://0.0.0.0:8000/openapi.json", timeout=5).json()
|
||||
r = requests.get("http://0.0.0.0:8000/openapi.json", timeout=10).json()
|
||||
|
||||
if not r:
|
||||
raise Exception("Could not get openapi.json")
|
||||
|
||||
@@ -111,12 +111,13 @@ def check_missing_params(
|
||||
for test_params in function_params:
|
||||
if isinstance(command_params, list):
|
||||
for expected_param in command_params[0]:
|
||||
if expected_param not in test_params.keys():
|
||||
# if return is the expected param, we can ignore
|
||||
if expected_param != "return":
|
||||
missing_params.append(
|
||||
f"Missing param {expected_param} in function {function}"
|
||||
)
|
||||
if (
|
||||
expected_param not in test_params.keys()
|
||||
and expected_param != "return"
|
||||
):
|
||||
missing_params.append(
|
||||
f"Missing param {expected_param} in function {function}"
|
||||
)
|
||||
return missing_params
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user