Esempio n. 1
0
    def test_create_with_command_exception(self):
        with self.assertRaises(Exception) as e:
            EventsResultFactory.create('exception', 'events_detail',
                                       'exception', 'Events', 'in_memory')

        self.assertEqual(str(e.exception),
                         'Command exception does not supported')
Esempio n. 2
0
    def test_create_with_respository_exception(self):
        with self.assertRaises(Exception) as e:
            EventsResultFactory.create('exception', 'events_detail',
                                       'exception', 'exception', 'in_memory')

        self.assertEqual(str(e.exception),
                         'Repository from exception does not supported')
Esempio n. 3
0
    def test_create_with_persistence_exception(self):
        with self.assertRaises(Exception) as e:
            EventsResultFactory.create('exception', 'events_detail',
                                       'exception', 'exception', 'exception')

        self.assertEqual(str(e.exception),
                         'Persistence type exception does not supported')
Esempio n. 4
0
    def test_create_with_exception(self):
        with self.assertRaises(Exception) as e:
            EventsResultFactory.create('exception', 'events_detail',
                                       'get_events_from_today', 'Events',
                                       'in_memory')

        self.assertEqual(str(e.exception),
                         'Result type exception does not supported')
Esempio n. 5
0
    def test_create_with_exception(self, resource_mock, command_mock, console_mock, html_mock):
        with self.assertRaises(Exception) as e:
            EventsResultFactory.create('exception', 'events_detail', 'get_events_from_today', 'Events', 'in_memory')

        self.assertEqual(str(e.exception), 'Result type exception does not supported')
        resource_mock.create.assert_called_once_with('events_detail')
        command_mock.create.assert_called_once_with(use_case='get_events_from_today', entity='Events', persistence_type='in_memory')
        console_mock.assert_not_called()
        html_mock.assert_not_called()
Esempio n. 6
0
    def test_create_with_command_exception(self, resource_mock, command_mock, console_mock, html_mock):
        command_mock.create.side_effect = Exception('Raise exception')
        with self.assertRaises(Exception) as e:
            EventsResultFactory.create('exception', 'events_detail', 'exception', 'Events', 'in_memory')

        self.assertEqual(str(e.exception), 'Raise exception')
        resource_mock.create.assert_called_once_with('events_detail')
        command_mock.create.assert_called_once_with(use_case='exception', entity='Events', persistence_type='in_memory')
        console_mock.assert_not_called()
        html_mock.assert_not_called()
Esempio n. 7
0
    def test_create_with_resource_exception(self, resource_mock, command_mock, console_mock, html_mock):
        resource_mock.create.side_effect = Exception('Raise exception')
        with self.assertRaises(Exception) as e:
            EventsResultFactory.create('exception', 'exception', 'exception', 'exception', 'exception')

        self.assertEqual(str(e.exception), 'Raise exception')
        resource_mock.create.assert_called_once_with('exception')
        command_mock.create.assert_not_called()
        console_mock.assert_not_called()
        html_mock.assert_not_called()
Esempio n. 8
0
 def test_create_html(self, resource_mock, command_mock, console_mock, html_mock):
     EventsResultFactory.create('html', 'events_detail', 'get_events_from_today', 'Events', 'in_memory')
     resource_mock.create.assert_called_once_with('events_detail')
     command_mock.create.assert_called_once_with(use_case='get_events_from_today', entity='Events', persistence_type='in_memory')
     console_mock.assert_not_called()
     html_mock.assert_called_once()
Esempio n. 9
0
 def test_create_html(self):
     html = EventsResultFactory.create('html', 'events_detail',
                                       'get_events_from_today', 'Events',
                                       'in_memory')
     self.assertEqual(type(html), HtmlEventsResult)
Esempio n. 10
0
 def test_create_cmd(self):
     cmd = EventsResultFactory.create('cmd', 'events_detail',
                                      'get_events_from_today', 'Events',
                                      'in_memory')
     self.assertEqual(type(cmd), ConsoleEventsResult)
Esempio n. 11
0
    def test_create_with_view_exception(self):
        with self.assertRaises(Exception) as e:
            EventsResultFactory.create('exception', 'exception', 'exception',
                                       'exception', 'exception')

        self.assertEqual(str(e.exception), 'View exception does not supported')