def test_get_releases_throws_exception(self): cdn_rv_provider = self._get_cdn_rv_provider() # mock content_connection so we can verify it's calls with mock.patch.object(cdn_rv_provider, "content_connection") as mock_cc: mock_cc.get_versions.side_effect = http.client.BadStatusLine( "some bogus status") releases = cdn_rv_provider.get_releases() self.assertEqual([], releases) mock_cc.get_versions.side_effect = socket.error() releases = cdn_rv_provider.get_releases() self.assertEqual([], releases) mock_cc.get_versions.side_effect = ssl.SSLError() releases = cdn_rv_provider.get_releases() self.assertEqual([], releases)
def test_he_ssl_error(self): e = ssl.SSLError() try: handle_exception("huh", e) except SystemExit as e: self.assertEqual(e.code, os.EX_SOFTWARE)
def test_hge_ssl_error(self): utils.log.set_expected_msg(self.msg) utils.handle_gui_exception(ssl.SSLError(), self.msg, None) self.assertEqual(utils.log.expected_msg, self.msg)