mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 04:31:13 +00:00
* Relink sdk/sdk -> platform/platform * Relink sdk -> platform * Rename folders * Fix dev_install script * Fix test generators * Fix test generators * Fix test generators * Organize imports
55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
import pytest
|
|
import requests
|
|
from openbb_provider.utils.helpers import get_querystring
|
|
|
|
|
|
def get_token():
|
|
return requests.post(
|
|
"http://0.0.0.0:8000/api/v1/account/token",
|
|
data={"username": "openbb", "password": "openbb"},
|
|
timeout=5,
|
|
)
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def headers():
|
|
access_token = get_token().json()["access_token"]
|
|
return {"Authorization": f"Bearer {access_token}"}
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"params",
|
|
[
|
|
({"limit": 20}),
|
|
(
|
|
{
|
|
"display": "full",
|
|
"date": "2023-01-01",
|
|
"start_date": "2023-01-01",
|
|
"end_date": "2023-06-06",
|
|
"updated_since": 1,
|
|
"published_since": 1,
|
|
"sort": "created",
|
|
"order": "desc",
|
|
"isin": "US0378331005",
|
|
"cusip": "037833100",
|
|
"channels": "General",
|
|
"topics": "AAPL",
|
|
"authors": "Benzinga Insights",
|
|
"content_types": "headline",
|
|
"provider": "benzinga",
|
|
"limit": 20,
|
|
}
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_news_globalnews(params, headers):
|
|
params = {p: v for p, v in params.items() if v}
|
|
|
|
query_str = get_querystring(params, [])
|
|
url = f"http://0.0.0.0:8000/api/v1/news/globalnews?{query_str}"
|
|
result = requests.get(url, headers=headers, timeout=5)
|
|
assert isinstance(result, requests.Response)
|
|
assert result.status_code == 200
|