summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2019-05-30 16:01:36 +0200
committerMatěj Cepl <mcepl@cepl.eu>2019-05-30 17:06:41 +0200
commitf287d7145b5fd28f630f2b823ad45a44cf635b35 (patch)
treea8214586a745e2d2e864497805cde0b22cb315ac /tests
parent55d4e9542de3519fb0085da9abfd8e0b8eee0d7a (diff)
downloadm2crypto-f287d7145b5fd28f630f2b823ad45a44cf635b35.tar.gz
Be resilient against the situation when no erorr happened.
Fixes #258.
Diffstat (limited to 'tests')
-rw-r--r--tests/alltests.py1
-rw-r--r--tests/test_err.py28
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/alltests.py b/tests/alltests.py
index a0e7739..141cd88 100644
--- a/tests/alltests.py
+++ b/tests/alltests.py
@@ -32,6 +32,7 @@ def suite():
'tests.test_dh',
'tests.test_dsa',
'tests.test_engine',
+ 'tests.test_err',
'tests.test_evp',
'tests.test_obj',
'tests.test_rand',
diff --git a/tests/test_err.py b/tests/test_err.py
new file mode 100644
index 0000000..05fe425
--- /dev/null
+++ b/tests/test_err.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""Unit tests for M2Crypto.Err.
+
+Copyright (C) 2019 Matěj Cepl
+Released under the terms of MIT/X11 License,
+see the file LICENCE for more.
+"""
+from M2Crypto import Err
+from tests import unittest
+
+
+class ErrTestCase(unittest.TestCase):
+
+ def test_no_error(self):
+ # Protection against gl#m2crypto/m2crypto#258
+ self.assertEqual(Err.get_error_reason(0), '')
+
+
+
+def suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(ErrTestCase))
+ return suite
+
+
+if __name__ == '__main__':
+ unittest.TextTestRunner().run(suite())