def test_yahoo_keystats_fail500(self, mockget): mockget.return_value = ResponseStatus500() screen = StockScreen(100) test = False try: screen.yahooKeyStats('aa') except HTTPError: test = True self.assertEqual(test, True)
def test_yahoo_keystats_success200(self, mockget): mockget.return_value = ResponseStatus200(self.yahoo_finance_html_path, 'aci') screen = StockScreen(100) expected_screen_output = "price to book ratio: aci, 0.05\nPEG ration: aci -0.01\n" output = screen.yahooKeyStats('aci') self.assertEqual(expected_screen_output, output)