--- /dev/null
+#!/usr/bin/env python3
+
+import unittest
+from unittest.mock import MagicMock, patch
+
+import google_assistant
+import unittest_utils # Needed for --unittests_ignore_perf flag
+
+
+class TestGoogleAssistant(unittest.TestCase):
+ def test_basic_functionality(self):
+
+ with patch('requests.post') as mock:
+ response = MagicMock()
+ response.status_code = 404
+ mock.return_value = response
+ ret = google_assistant.ask_google('What happens with a 404 response?')
+ self.assertFalse(ret.success)
+ self.assertTrue('failed; code 404' in ret.response)
+ self.assertEqual('', ret.audio_transcription)
+ self.assertEqual('', ret.audio_url)
+
+
+if __name__ == '__main__':
+ unittest.main()