class JsonExceptionFormatterTests(FantasticoUnitTestsCase):
    '''This class provides the tests suite for JsonExceptionFormatter.'''

    _formatter = None

    def init(self):
        '''This method is invoked automatically to setup common dependencies for all test cases.'''

        self._formatter = JsonExceptionFormatter()

    def test_format_ex_ok(self):
        '''This test case ensures exceptions are correctly converted to json strings.'''

        ex_desc = {"attr1": "sample", "attr2": "value"}

        expected_response = json.dumps(ex_desc)

        self.assertEqual(expected_response, self._formatter.format_ex(ex_desc))

    def test_format_ex_none(self):
        '''This test case ensures no exception is raised when formatting a None exception descriptor.'''

        self.assertEqual("\"{}\"", self._formatter.format_ex(None))
class JsonExceptionFormatterTests(FantasticoUnitTestsCase):
    '''This class provides the tests suite for JsonExceptionFormatter.'''

    _formatter = None

    def init(self):
        '''This method is invoked automatically to setup common dependencies for all test cases.'''

        self._formatter = JsonExceptionFormatter()

    def test_format_ex_ok(self):
        '''This test case ensures exceptions are correctly converted to json strings.'''

        ex_desc = {"attr1": "sample",
                   "attr2": "value"}

        expected_response = json.dumps(ex_desc)

        self.assertEqual(expected_response, self._formatter.format_ex(ex_desc))

    def test_format_ex_none(self):
        '''This test case ensures no exception is raised when formatting a None exception descriptor.'''

        self.assertEqual("\"{}\"", self._formatter.format_ex(None))
    def init(self):
        '''This method is invoked automatically to setup common dependencies for all test cases.'''

        self._formatter = JsonExceptionFormatter()
    def init(self):
        '''This method is invoked automatically to setup common dependencies for all test cases.'''

        self._formatter = JsonExceptionFormatter()