idea for getting financials for an arbitrary number of companies
This commit is contained in:
parent
fd03815172
commit
e7f3730c64
@ -160,11 +160,32 @@ class FunctionsTestCase(IsolatedAsyncioTestCase):
|
|||||||
CF: {END_DATE: mock_end_dates, 'c': (3, 4)}
|
CF: {END_DATE: mock_end_dates, 'c': (3, 4)}
|
||||||
}
|
}
|
||||||
symbol, quarterly, mock_session = 'foo', False, MagicMock()
|
symbol, quarterly, mock_session = 'foo', False, MagicMock()
|
||||||
output = await functions.get_company_financials(symbol, quarterly, mock_session)
|
output = await functions.get_company_financials(symbol, quarterly=quarterly, session=mock_session)
|
||||||
self.assertDictEqual(expected_output, output)
|
self.assertDictEqual(expected_output, output)
|
||||||
mock_get_bs.assert_called_once_with(symbol, quarterly, mock_session)
|
mock_get_bs.assert_called_once_with(symbol, quarterly, mock_session)
|
||||||
mock_get_is.assert_called_once_with(symbol, quarterly, mock_session)
|
mock_get_is.assert_called_once_with(symbol, quarterly, mock_session)
|
||||||
mock_get_cf.assert_called_once_with(symbol, quarterly, mock_session)
|
mock_get_cf.assert_called_once_with(symbol, quarterly, mock_session)
|
||||||
|
mock_get_bs.reset_mock()
|
||||||
|
mock_get_is.reset_mock()
|
||||||
|
mock_get_cf.reset_mock()
|
||||||
|
|
||||||
|
test_symbol1, test_symbol2 = 'x', 'y'
|
||||||
|
expected_output = {test_symbol1: expected_output, test_symbol2: expected_output}
|
||||||
|
output = await functions.get_company_financials(test_symbol1, test_symbol2,
|
||||||
|
quarterly=quarterly, session=mock_session)
|
||||||
|
self.assertDictEqual(expected_output, output)
|
||||||
|
mock_get_bs.assert_has_calls([
|
||||||
|
call(test_symbol1, quarterly, mock_session),
|
||||||
|
call(test_symbol2, quarterly, mock_session)
|
||||||
|
])
|
||||||
|
mock_get_is.assert_has_calls([
|
||||||
|
call(test_symbol1, quarterly, mock_session),
|
||||||
|
call(test_symbol2, quarterly, mock_session)
|
||||||
|
])
|
||||||
|
mock_get_cf.assert_has_calls([
|
||||||
|
call(test_symbol1, quarterly, mock_session),
|
||||||
|
call(test_symbol2, quarterly, mock_session)
|
||||||
|
])
|
||||||
|
|
||||||
@patch.object(functions, 'ClientSession')
|
@patch.object(functions, 'ClientSession')
|
||||||
async def test_integration_get_company_financials(self, mock_session_cls):
|
async def test_integration_get_company_financials(self, mock_session_cls):
|
||||||
|
Loading…
Reference in New Issue
Block a user