diff options
Diffstat (limited to 'gitlab/tests/test_exceptions.py')
-rw-r--r-- | gitlab/tests/test_exceptions.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gitlab/tests/test_exceptions.py b/gitlab/tests/test_exceptions.py new file mode 100644 index 0000000..1f00af0 --- /dev/null +++ b/gitlab/tests/test_exceptions.py @@ -0,0 +1,19 @@ +import unittest + +from gitlab import exceptions + + +class TestExceptions(unittest.TestCase): + def test_error_raises_from_http_error(self): + """Methods decorated with @on_http_error should raise from GitlabHttpError.""" + + class TestError(Exception): + pass + + @exceptions.on_http_error(TestError) + def raise_error_from_http_error(): + raise exceptions.GitlabHttpError + + with self.assertRaises(TestError) as context: + raise_error_from_http_error() + self.assertIsInstance(context.exception.__cause__, exceptions.GitlabHttpError) |