summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Radovanovic <74266147+IgorWounds@users.noreply.github.com>2024-02-15 17:24:10 +0100
committerGitHub <noreply@github.com>2024-02-15 16:24:10 +0000
commit9903876093bb6daefababb76858a8188fb835925 (patch)
tree98dea49ccef9b0fc8af0eb7893557f8f2229d66c
parent07e98ab58b029b76762d2d5acb3ef537d33c864a (diff)
[BugFix] - Fix most integration tests (#6082)
* Fix most integration tests * Lint
-rw-r--r--openbb_platform/extensions/crypto/integration/test_crypto_api.py2
-rw-r--r--openbb_platform/extensions/crypto/integration/test_crypto_python.py2
-rw-r--r--openbb_platform/extensions/derivatives/integration/test_derivatives_api.py2
-rw-r--r--openbb_platform/extensions/econometrics/openbb_econometrics/econometrics_router.py2
-rw-r--r--openbb_platform/extensions/economy/integration/test_economy_api.py10
-rw-r--r--openbb_platform/extensions/economy/integration/test_economy_python.py2
-rw-r--r--openbb_platform/extensions/equity/integration/test_equity_api.py4
-rw-r--r--openbb_platform/extensions/equity/integration/test_equity_python.py2
-rw-r--r--openbb_platform/extensions/index/integration/test_index_api.py4
-rw-r--r--openbb_platform/extensions/index/integration/test_index_python.py10
-rw-r--r--openbb_platform/extensions/news/integration/test_news_python.py2
-rw-r--r--openbb_platform/extensions/tests/conftest.py20
-rw-r--r--openbb_platform/providers/intrinio/openbb_intrinio/models/historical_attributes.py5
-rw-r--r--openbb_platform/providers/intrinio/openbb_intrinio/models/latest_attributes.py5
14 files changed, 47 insertions, 25 deletions
diff --git a/openbb_platform/extensions/crypto/integration/test_crypto_api.py b/openbb_platform/extensions/crypto/integration/test_crypto_api.py
index 97ff10da864..e91f92be6c5 100644
--- a/openbb_platform/extensions/crypto/integration/test_crypto_api.py
+++ b/openbb_platform/extensions/crypto/integration/test_crypto_api.py
@@ -98,7 +98,7 @@ def test_crypto_search(params, headers):
"provider": "yfinance",
"symbol": "BTCUSD",
"start_date": "2023-01-01",
- "end_date": "2023-06-06",
+ "end_date": "2023-01-03",
}
),
(
diff --git a/openbb_platform/extensions/crypto/integration/test_crypto_python.py b/openbb_platform/extensions/crypto/integration/test_crypto_python.py
index e8d3ba097a5..4376855d0e4 100644
--- a/openbb_platform/extensions/crypto/integration/test_crypto_python.py
+++ b/openbb_platform/extensions/crypto/integration/test_crypto_python.py
@@ -92,7 +92,7 @@ def test_crypto_search(params, obb):
"provider": "yfinance",
"symbol": "BTCUSD",
"start_date": "2023-01-01",
- "end_date": "2023-06-06",
+ "end_date": "2023-01-04",
}
),
(
diff --git a/openbb_platform/extensions/derivatives/integration/test_derivatives_api.py b/openbb_platform/extensions/derivatives/integration/test_derivatives_api.py
index 15941af3847..c6e6acb0053 100644
--- a/openbb_platform/extensions/derivatives/integration/test_derivatives_api.py
+++ b/openbb_platform/extensions/derivatives/integration/test_derivatives_api.py
@@ -96,6 +96,6 @@ def test_derivatives_futures_curve(params, headers):
query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/derivatives/futures/curve?{query_str}"
- result = requests.get(url, headers=headers, timeout=30)
+ result = requests.get(url, headers=headers, timeout=60)
assert isinstance(result, requests.Response)
assert result.status_code == 200
diff --git a/openbb_platform/extensions/econometrics/openbb_econometrics/econometrics_router.py b/openbb_platform/extensions/econometrics/openbb_econometrics/econometrics_router.py
index f733ef07fd0..5ef694fc90e 100644
--- a/openbb_platform/extensions/econometrics/openbb_econometrics/econometrics_router.py
+++ b/openbb_platform/extensions/econometrics/openbb_econometrics/econometrics_router.py
@@ -188,7 +188,7 @@ def autocorrelation(
data: List[Data],
y_column: str,
x_columns: List[str],
-) -> OBBject[Dict]:
+) -> OBBject[Data]:
"""Perform Durbin-Watson test for autocorrelation.
The Durbin-Watson test is a widely used method for detecting the presence of autocorrelation in the residuals
diff --git a/openbb_platform/extensions/economy/integration/test_economy_api.py b/openbb_platform/extensions/economy/integration/test_economy_api.py
index 6a5ac1eb362..8ce32c0e1db 100644
--- a/openbb_platform/extensions/economy/integration/test_economy_api.py
+++ b/openbb_platform/extensions/economy/integration/test_economy_api.py
@@ -395,7 +395,7 @@ def test_economy_money_measures(params, headers):
@parametrize(
"params",
[
- ({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
+ ({"start_date": "2023-01-01", "end_date": "2023-06-06", "provider": "oecd"}),
(
{
"country": "united_states",
@@ -424,7 +424,7 @@ def test_economy_unemployment(params, headers):
@parametrize(
"params",
[
- ({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
+ ({"start_date": "2023-01-01", "end_date": "2023-06-06", "provider": "oecd"}),
(
{
"country": "united_states",
@@ -449,7 +449,7 @@ def test_economy_composite_leading_indicator(params, headers):
@parametrize(
"params",
[
- ({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
+ ({"start_date": "2023-01-01", "end_date": "2023-06-06", "provider": "oecd"}),
(
{
"country": "united_states",
@@ -467,7 +467,7 @@ def test_economy_short_term_interest_rate(params, headers):
query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/economy/short_term_interest_rate?{query_str}"
- result = requests.get(url, headers=headers, timeout=10)
+ result = requests.get(url, headers=headers, timeout=30)
assert isinstance(result, requests.Response)
assert result.status_code == 200
@@ -475,7 +475,7 @@ def test_economy_short_term_interest_rate(params, headers):
@parametrize(
"params",
[
- ({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
+ ({"start_date": "2023-01-01", "end_date": "2023-06-06", "provider": "oecd"}),
(
{
"country": "united_states",
diff --git a/openbb_platform/extensions/economy/integration/test_economy_python.py b/openbb_platform/extensions/economy/integration/test_economy_python.py
index 8c4c7ff14c6..8973e268884 100644
--- a/openbb_platform/extensions/economy/integration/test_economy_python.py
+++ b/openbb_platform/extensions/economy/integration/test_economy_python.py
@@ -491,7 +491,7 @@ def test_economy_long_term_interest_rate(params, obb):
def test_economy_fred_regional(params, obb):
params = {p: v for p, v in params.items() if v}
- result = obb.economy.long_term_interest_rate(**params)
+ result = obb.economy.fred_regional(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
diff --git a/openbb_platform/extensions/equity/integration/test_equity_api.py b/openbb_platform/extensions/equity/integration/test_equity_api.py
index c34badc62a5..4a69d38954a 100644
--- a/openbb_platform/extensions/equity/integration/test_equity_api.py
+++ b/openbb_platform/extensions/equity/integration/test_equity_api.py
@@ -959,7 +959,7 @@ def test_equity_compare_groups(params, headers):
"provider": "polygon",
"symbol": "AAPL",
"start_date": "2023-01-01",
- "end_date": "2023-01-02",
+ "end_date": "2023-01-04",
"interval": "1m",
}
),
@@ -1295,9 +1295,7 @@ def test_equity_price_quote(params, headers):
@parametrize(
"params",
[
- ({"symbol": "AAPL", "provider": "cboe"}),
({"symbol": "MSFT", "provider": "intrinio"}),
- ({"symbol": "AAPL,MSFT", "provider": "cboe"}),
({"symbol": "AAPL,MSFT", "provider": "intrinio"}),
({"symbol": "AAPL,MSFT", "provider": "finviz"}),
({"symbol": "AAPL,MSFT", "provider": "yfinance"}),
diff --git a/openbb_platform/extensions/equity/integration/test_equity_python.py b/openbb_platform/extensions/equity/integration/test_equity_python.py
index 7c97baaea18..d6af76fc62a 100644
--- a/openbb_platform/extensions/equity/integration/test_equity_python.py
+++ b/openbb_platform/extensions/equity/integration/test_equity_python.py
@@ -1127,7 +1127,7 @@ def test_equity_fundamental_historical_attributes(params, obb):
(
{
"provider": "intrinio",
- "symbol": ["AAPL", "MSFT"],
+ "symbol": ["MSFT", "AAPL"],
"tag": ["ceo", "ebitda"],
}
),
diff --git a/openbb_platform/extensions/index/integration/test_index_api.py b/openbb_platform/extensions/index/integration/test_index_api.py
index 9a0df1c8e44..fb8d0209108 100644
--- a/openbb_platform/extensions/index/integration/test_index_api.py
+++ b/openbb_platform/extensions/index/integration/test_index_api.py
@@ -155,10 +155,10 @@ def test_index_price_historical(params, headers):
{
"symbol": "^DJI",
"start_date": "2023-01-01",
- "end_date": "2023-06-06",
+ "end_date": "2023-03-03",
"provider": "fmp",
"sort": "desc",
- "interval": None,
+ "interval": "1day",
"limit": None,
}
),
diff --git a/openbb_platform/extensions/index/integration/test_index_python.py b/openbb_platform/extensions/index/integration/test_index_python.py
index 80139634288..fbf8e586165 100644
--- a/openbb_platform/extensions/index/integration/test_index_python.py
+++ b/openbb_platform/extensions/index/integration/test_index_python.py
@@ -38,7 +38,7 @@ def test_index_constituents(params, obb):
[
(
{
- "interval": "1m",
+ "interval": "1d",
"provider": "cboe",
"symbol": "AAVE100",
"start_date": "2024-01-01",
@@ -148,20 +148,20 @@ def test_index_price_historical(params, obb):
{
"symbol": "^DJI",
"start_date": "2023-01-01",
- "end_date": "2023-06-06",
+ "end_date": "2023-03-03",
"provider": "fmp",
"sort": "desc",
- "interval": None,
+ "interval": "1day",
"limit": None,
}
),
(
{
- "interval": "1m",
+ "interval": "1d",
"provider": "cboe",
"symbol": "AAVE100",
"start_date": "2023-01-01",
- "end_date": "2023-06-06",
+ "end_date": "2023-01-05",
"use_cache": True,
"limit": None,
"sort": None,
diff --git a/openbb_platform/extensions/news/integration/test_news_python.py b/openbb_platform/extensions/news/integration/test_news_python.py
index 755e51109ba..381c26fd2cf 100644
--- a/openbb_platform/extensions/news/integration/test_news_python.py
+++ b/openbb_platform/extensions/news/integration/test_news_python.py
@@ -153,7 +153,7 @@ def test_news_world(params, obb):
(
{
"provider": "tiingo",
- "symbol": "AAPL,MSFT",
+ "symbol": "AAPL",
"limit": 20,
"source": "bloomberg.com",
"start_date": None,
diff --git a/openbb_platform/extensions/tests/conftest.py b/openbb_platform/extensions/tests/conftest.py
index 45b1962f5fb..45f1b849572 100644
--- a/openbb_platform/extensions/tests/conftest.py
+++ b/openbb_platform/extensions/tests/conftest.py
@@ -10,6 +10,8 @@ from extensions.tests.utils.helpers import list_openbb_extensions
cm = CommandMap()
commands = list(cm.map.keys())
+# ruff: noqa: SIM114
+
def parametrize(argnames: str, argvalues: List[Dict], **kwargs):
"""Custom parametrize decorator that filters test cases based on the environment."""
@@ -21,7 +23,17 @@ def parametrize(argnames: str, argvalues: List[Dict], **kwargs):
filtered_argvalues: List[Dict] = []
extension_name = function.__name__.split("_")[1]
function_name = "/" + "/".join(function.__name__.split("_")[1:])
-
+ # this handles edge cases where the function name has an underscore
+ function_name_v2 = (
+ function_name.rsplit("/", 1)[0] + "_" + function_name.rsplit("/", 1)[1]
+ )
+ function_name_v3 = (
+ function_name.rsplit("/", 2)[0]
+ + "_"
+ + function_name.rsplit("/", 2)[1]
+ + "_"
+ + function_name.rsplit("/", 1)[1].replace("/", "_")
+ )
if extension_name in extensions:
for args in argvalues:
if "provider" in args and args["provider"] in providers:
@@ -29,6 +41,12 @@ def parametrize(argnames: str, argvalues: List[Dict], **kwargs):
elif "provider" not in args and function_name in commands:
# Run the standard test case
filtered_argvalues.append(args)
+ elif "provider" not in args and function_name_v2 in commands:
+ # Handle edge case
+ filtered_argvalues.append(args)
+ elif "provider" not in args and function_name_v3 in commands:
+ # Handle edge case
+ filtered_argvalues.append(args)
return pytest.mark.parametrize(argnames, filtered_argvalues, **kwargs)(
function
)
diff --git a/openbb_platform/providers/intrinio/openbb_intrinio/models/historical_attributes.py b/openbb_platform/providers/intrinio/openbb_intrinio/models/historical_attributes.py
index 66972313dcf..47ce6983108 100644
--- a/openbb_platform/providers/intrinio/openbb_intrinio/models/historical_attributes.py
+++ b/openbb_platform/providers/intrinio/openbb_intrinio/models/historical_attributes.py
@@ -26,7 +26,10 @@ class IntrinioHistoricalAttributesQueryParams(HistoricalAttributesQueryParams):
"""
__alias_dict__ = {"sort": "sort_order", "limit": "page_size", "tag_type": "type"}
- __json_schema_extra__ = {"tag": ["multiple_items_allowed"]}
+ __json_schema_extra__ = {
+ "tag": ["multiple_items_allowed"],
+ "symbol": ["multiple_items_allowed"],
+ }
class IntrinioHistoricalAttributesData(HistoricalAttributesData):
diff --git a/openbb_platform/providers/intrinio/openbb_intrinio/models/latest_attributes.py b/openbb_platform/providers/intrinio/openbb_intrinio/models/latest_attributes.py
index b62f76c07d7..ca635744259 100644
--- a/openbb_platform/providers/intrinio/openbb_intrinio/models/latest_attributes.py
+++ b/openbb_platform/providers/intrinio/openbb_intrinio/models/latest_attributes.py
@@ -22,7 +22,10 @@ class IntrinioLatestAttributesQueryParams(LatestAttributesQueryParams):
https://docs.intrinio.com/documentation/web_api/get_data_point_text_v2
"""
- __json_schema_extra__ = {"tag": ["multiple_items_allowed"]}
+ __json_schema_extra__ = {
+ "tag": ["multiple_items_allowed"],
+ "symbol": ["multiple_items_allowed"],
+ }
class IntrinioLatestAttributesData(LatestAttributesData):