This commit is contained in:
Igor Radovanovic
2023-09-25 18:24:27 +02:00
parent eef90234d9
commit b952799629
4 changed files with 19 additions and 8 deletions

View File

@@ -1,3 +1,5 @@
import datetime
import pytest
import requests
from openbb_provider.utils.helpers import get_querystring

View File

@@ -281,7 +281,13 @@ def test_stocks_fa_ins(params):
@pytest.mark.parametrize(
"params",
[
({"symbol": "AAPL", "include_current_quarter": True, "date": "2023-01-01"}),
(
{
"symbol": "AAPL",
"include_current_quarter": True,
"date": datetime.date(2023, 1, 1),
}
),
],
)
def test_stocks_fa_ins_own(params):
@@ -333,7 +339,7 @@ def test_stocks_fa_overview(params):
@pytest.mark.parametrize(
"params",
[
({"symbol": "AAPL", "date": "2023-01-01", "page": 1}),
({"symbol": "AAPL", "date": datetime.date(2023, 1, 1), "page": 1}),
],
)
def test_stocks_fa_own(params):
@@ -478,7 +484,7 @@ def test_stocks_ca_peers(params):
"params",
[
({"symbol": "AAPL"}),
({"date": "2023-01-01", "provider": "intrinio", "symbol": "AAPL"}),
({"date": datetime.date(2023, 1, 1), "provider": "intrinio", "symbol": "AAPL"}),
],
)
def test_stocks_options_chains(params):
@@ -590,7 +596,7 @@ def test_stocks_load(params):
(
{
"display": "full",
"date": "2023-01-01",
"date": datetime.date(2023, 1, 1),
"start_date": datetime.date(2023, 1, 1),
"end_date": datetime.date(2023, 6, 6),
"updated_since": 1,
@@ -610,7 +616,7 @@ def test_stocks_load(params):
),
(
{
"published_utc": "2023-01-01",
"published_utc": datetime.date(2023, 1, 1),
"order": "desc",
"provider": "polygon",
"symbols": "AAPL",

View File

@@ -3,6 +3,7 @@ from pathlib import Path, PosixPath
from typing import Any, Dict, List, Literal, get_origin
from pydantic.fields import ModelField
from sdk.core.openbb_core.app.provider_interface import ProviderInterface
from sdk.core.openbb_core.app.router import CommandMap
@@ -150,7 +151,7 @@ def test_{test_name}(params):
for test_params in test_params_list:
params += f"({test_params}),\n"
read_file = open(test_file)
read_file = open(test_file) # noqa
if full_command_name not in read_file.read():
f.write(
template.format(

View File

@@ -66,7 +66,7 @@ def test_{route.replace("/", "_")[1:]}(params, headers):
def test_exists(route: str, path: str):
with open(path, "r") as f:
with open(path) as f:
return route.replace("/", "_")[1:] in f.read()
@@ -129,4 +129,6 @@ if __name__ == "__main__":
)
if commands_not_found_in_openapi:
print(f"Commands not found in openapi.json: {commands_not_found_in_openapi}")
print( # noqa
f"Commands not found in openapi.json: {commands_not_found_in_openapi}"
)