Full coverage in exceptions.
This commit is contained in:
parent
9cd6522b26
commit
e29423c32e
4 changed files with 49 additions and 0 deletions
0
matemat/exceptions/test/__init__.py
Normal file
0
matemat/exceptions/test/__init__.py
Normal file
15
matemat/exceptions/test/test_authentication_error.py
Normal file
15
matemat/exceptions/test/test_authentication_error.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from matemat.exceptions import AuthenticationError
|
||||
|
||||
|
||||
class TestAuthenticationError(unittest.TestCase):
|
||||
|
||||
def test_msg(self):
|
||||
e = AuthenticationError('testmsg')
|
||||
self.assertEqual('testmsg', e.msg)
|
||||
|
||||
def test_str(self):
|
||||
e = AuthenticationError('testmsg')
|
||||
self.assertEqual('AuthenticationError: testmsg', str(e))
|
15
matemat/exceptions/test/test_database_consistency_error.py
Normal file
15
matemat/exceptions/test/test_database_consistency_error.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from matemat.exceptions import DatabaseConsistencyError
|
||||
|
||||
|
||||
class TestDatabaseConsistencyError(unittest.TestCase):
|
||||
|
||||
def test_msg(self):
|
||||
e = DatabaseConsistencyError('testmsg')
|
||||
self.assertEqual('testmsg', e.msg)
|
||||
|
||||
def test_str(self):
|
||||
e = DatabaseConsistencyError('testmsg')
|
||||
self.assertEqual('DatabaseConsistencyError: testmsg', str(e))
|
19
matemat/exceptions/test/test_http_exception.py
Normal file
19
matemat/exceptions/test/test_http_exception.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from matemat.exceptions import HttpException
|
||||
|
||||
|
||||
class TestHttpException(unittest.TestCase):
|
||||
|
||||
def test_all_args(self):
|
||||
e = HttpException(1337, 'Foo Bar', 'Lorem Ipsum Dolor Sit Amet')
|
||||
self.assertEqual(1337, e.status)
|
||||
self.assertEqual('Foo Bar', e.title)
|
||||
self.assertEqual('Lorem Ipsum Dolor Sit Amet', e.message)
|
||||
|
||||
def test_default_args(self):
|
||||
e = HttpException()
|
||||
self.assertEqual(500, e.status)
|
||||
self.assertEqual('An error occurred', e.title)
|
||||
self.assertIsNone(e.message)
|
Loading…
Reference in a new issue