def test_action_telljoke_calls_api_client_fetch_with_accept_header( mock_fetch_raw): joke = 'ha ha, great joke!' cc_bot = CCBot() response = cc_bot.action_telljoke(None) mock_fetch_raw.assert_called_with("https://icanhazdadjoke.com/", {'Accept': 'text/plain'})
def test_action_telljoke_calls_api_client_fetch(): joke = 'ha ha, great joke!' cc_bot = CCBot() api_client = ApiClient() api_client.fetch_raw = MagicMock(return_value=joke) cc_bot.api_client = api_client response = cc_bot.action_telljoke(None) assert response == joke