mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
Add sector news route and test placeholders (#5828)
This commit is contained in:
committed by
GitHub
parent
3eb640cd21
commit
0f78bdc514
@@ -157,3 +157,16 @@ def test_news_company(params, headers):
|
||||
result = requests.get(url, headers=headers, timeout=10)
|
||||
assert isinstance(result, requests.Response)
|
||||
assert result.status_code == 200
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="No providers implement this yet.")
|
||||
@pytest.mark.parametrize("params", [])
|
||||
@pytest.mark.integration
|
||||
def test_news_sector(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/sector?{query_str}"
|
||||
result = requests.get(url, headers=headers, timeout=10)
|
||||
assert isinstance(result, requests.Response)
|
||||
assert result.status_code == 200
|
||||
|
||||
@@ -150,3 +150,15 @@ def test_news_company(params, obb):
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Not providers implement this yet.")
|
||||
@pytest.mark.parametrize("params", [])
|
||||
@pytest.mark.integration
|
||||
def test_news_sector(params, obb):
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
|
||||
result = obb.news.sector(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
@@ -35,3 +35,14 @@ async def company(
|
||||
) -> OBBject[BaseModel]:
|
||||
"""Company News. Get news for one or more companies."""
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
|
||||
@router.command(model="SectorNews")
|
||||
async def sector(
|
||||
cc: CommandContext,
|
||||
provider_choices: ProviderChoices,
|
||||
standard_params: StandardParams,
|
||||
extra_params: ExtraParams,
|
||||
) -> OBBject[BaseModel]:
|
||||
"""Sector News. Get news for one or more sectors."""
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
Reference in New Issue
Block a user