def _assert_map_exceptions(self, expected_exc, ksa_exc, func): os_exc = self.assertRaises(expected_exc, session.map_exceptions(func)) self.assertIsInstance(os_exc, expected_exc) self.assertEqual(ksa_exc.message, os_exc.message) self.assertEqual(ksa_exc.http_status, os_exc.http_status) self.assertEqual(ksa_exc, os_exc.cause) return os_exc
def test_map_exceptions_sdk_exception_2(self): ksa_exc = _exceptions.VersionNotAvailable() func = mock.Mock(side_effect=ksa_exc) os_exc = self.assertRaises(exceptions.SDKException, session.map_exceptions(func)) self.assertIsInstance(os_exc, exceptions.SDKException) self.assertEqual(ksa_exc, os_exc.cause)
def _assert_map_exceptions(self, expected_exc, ksa_exc, func): os_exc = self.assertRaises( expected_exc, session.map_exceptions(func)) self.assertIsInstance(os_exc, expected_exc) self.assertEqual(ksa_exc.message, os_exc.message) self.assertEqual(ksa_exc.http_status, os_exc.http_status) self.assertEqual(ksa_exc, os_exc.cause) return os_exc
def test_map_exceptions_sdk_exception_2(self): ksa_exc = _exceptions.VersionNotAvailable() func = mock.Mock(side_effect=ksa_exc) os_exc = self.assertRaises( exceptions.SDKException, session.map_exceptions(func)) self.assertIsInstance(os_exc, exceptions.SDKException) self.assertEqual(ksa_exc, os_exc.cause)
def test_map_exceptions_http_exception(self): ksa_exc = _exceptions.HttpError(message="test", http_status=400) func = mock.Mock(side_effect=ksa_exc) os_exc = self.assertRaises(exceptions.HttpException, session.map_exceptions(func)) self.assertIsInstance(os_exc, exceptions.HttpException) self.assertEqual(ksa_exc.message, os_exc.message) self.assertEqual(ksa_exc.http_status, os_exc.http_status) self.assertEqual(ksa_exc, os_exc.cause)
def test_map_exceptions_http_exception(self): ksa_exc = _exceptions.HttpError(message="test", http_status=400) func = mock.Mock(side_effect=ksa_exc) os_exc = self.assertRaises( exceptions.HttpException, session.map_exceptions(func)) self.assertIsInstance(os_exc, exceptions.HttpException) self.assertEqual(ksa_exc.message, os_exc.message) self.assertEqual(ksa_exc.http_status, os_exc.http_status) self.assertEqual(ksa_exc, os_exc.cause)