Completed
Push — master ( 487942...c6813c )
by dotzero
01:54
created

TildaErrorTest.test_page_str()   A

Complexity

Conditions 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
dl 0
loc 13
rs 9.4285
c 1
b 0
f 0
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
#
4
# Copyright (c) 2016 dotzero <[email protected]>
5
#
6
# Permission is hereby granted, free of charge, to any person obtaining a copy
7
# of this software and associated documentation files (the "Software"), to deal
8
# in the Software without restriction, including without limitation the rights
9
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
# copies of the Software, and to permit persons to whom the Software is
11
# furnished to do so, subject to the following conditions:
12
#
13
# The above copyright notice and this permission notice shall be included
14
# in all copies or substantial portions of the Software.
15
#
16
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
# SOFTWARE.
23
24
"""This module contains a object that represents Tests for TildaError"""
25
26
import unittest
27
import sys
28
from tilda import TildaError
29
from tests.base import BaseTest
30
31
sys.path.append('.')
32
33
34
class TildaErrorTest(BaseTest, unittest.TestCase):
35
    """This object represents Tests for TildaError."""
36
37
    def test_page_init(self):
38
        """Test TildaError.__init__() method"""
39
        print('Testing TildaError.__init__()')
40
41
        try:
42
            raise TildaError()
43
        except TildaError as e:
44
            self.assertEqual(e.status, '')
45
            self.assertEqual(e.message, '')
46
            self.assertEqual(e.errorside, '')
47
48
    def test_page_str(self):
49
        """Test TildaError.__str__() method"""
50
        print('Testing TildaError.__str__()')
51
52
        try:
53
            raise TildaError({
54
                'status': 200,
55
                'message': 'OK',
56
            })
57
        except TildaError as e:
58
            self.assertEqual(e.status, 200)
59
            self.assertEqual(e.message, 'OK')
60
            self.assertEqual(str(e), 'OK')
61
62
63
if __name__ == '__main__':
64
    unittest.main()
65