Esempio n. 1
0
def stocks_intent(stock):
    """Gets the price of a stock."""
    stock_name = stocks.suggest_stock_symbol(stock)
    price = stocks.get_stock_price(stock_name)
    message = f'The price of {stock_name} is {price}'
    return question(message + '. Do you want to know something else').reprompt(
        'Can you repeat that?')
Esempio n. 2
0
 def test_suggest_stock_garbage_response(self, mock_get):
     madeup = stocks.suggest_stock_symbol('MADEUP')
     self.assertIsNone(madeup)
Esempio n. 3
0
 def test_suggest_stock_could_not_be_found(self, mock_get):
     madeup = stocks.suggest_stock_symbol('MADEUP')
     self.assertIsNone(madeup)
Esempio n. 4
0
 def test_suggest_stock_failed(self, mock_get):
     madeup = stocks.suggest_stock_symbol('MADEUP')
     self.assertIsNone(madeup)
Esempio n. 5
0
 def test_suggest_stock_successful(self, mock_get):
     coke = stocks.suggest_stock_symbol('COKE')
     self.assertEqual(coke.upper(), 'COKE')