test: fix broken tests after refactor
- Update test_openbb_service to import from obb_utils (to_list, first_or_empty) instead of removed _to_dicts/_first_or_empty - Update test_stock_upgrades to mock openbb_service instead of finnhub_service (upgrades moved to yfinance)
This commit is contained in:
@@ -66,10 +66,12 @@ async def test_stock_recommendations(mock_recs, client):
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@patch("routes_sentiment.finnhub_service.get_upgrade_downgrade", new_callable=AsyncMock)
|
||||
@patch("routes_sentiment.openbb_service.get_upgrades_downgrades", new_callable=AsyncMock)
|
||||
async def test_stock_upgrades(mock_upgrades, client):
|
||||
mock_upgrades.return_value = [
|
||||
{"company": "Morgan Stanley", "action": "upgrade", "fromGrade": "Hold", "toGrade": "Buy"}
|
||||
{"date": "2026-03-05", "company": "Morgan Stanley", "action": "upgrade",
|
||||
"from_grade": "Hold", "to_grade": "Buy", "price_target_action": "Raises",
|
||||
"current_price_target": 300.0, "prior_price_target": 250.0}
|
||||
]
|
||||
resp = await client.get("/api/v1/stock/AAPL/upgrades")
|
||||
assert resp.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user