Exemplo n.º 1
0
    def test_01_listing(self):

        view = DummyResource(self.request, self.context)
        response = view.get()

        self.assertEqual(response['data'], [])
        self.assertNotIn('prev_page', response)
Exemplo n.º 2
0
    def test_07_listing_mode(self):

        self.request.params['mode'] = u'test'

        view = DummyResource(self.request, self.context)
        response = view.get()

        self.assertEqual(response['data'], [])
Exemplo n.º 3
0
    def test_06_listing_feed(self):

        self.request.params['feed'] = 'changes'

        view = DummyResource(self.request, self.context)
        response = view.get()

        self.assertEqual(response['data'], [])
Exemplo n.º 4
0
    def test_05_listing_descending(self):

        self.request.params['descending'] = '1'

        view = DummyResource(self.request, self.context)
        response = view.get()

        self.assertEqual(response['data'], [])
Exemplo n.º 5
0
    def test_04_listing_offset(self):

        self.request.params['offset'] = '2015-01-01T00:00:00+02:00'

        view = DummyResource(self.request, self.context)
        response = view.get()

        self.assertEqual(response['data'], [])
Exemplo n.º 6
0
    def test_03_listing_limit(self):

        self.request.params['limit'] = '10'

        view = DummyResource(self.request, self.context)
        response = view.get()

        self.assertEqual(response['data'], [])
Exemplo n.º 7
0
    def test_02_listing_opt_fields(self):

        self.request.params['opt_fields'] = 'status'
        self.request.logging_context = MagicMock()

        view = DummyResource(self.request, self.context)
        response = view.get()

        self.assertEqual(response['data'], [])
Exemplo n.º 8
0
    def test_08_listing_feed_and_offset_error(self):

        self.request.errors = Mock(**{'add': Mock()})

        self.request.params['feed'] = 'changes'
        self.request.params['offset'] = '0'

        view = DummyResource(self.request, self.context)

        class OffsetExpired(Exception):
            """ Test exception for error_handler mocking"""

        with patch('openregistry.api.utils.error_handler',
                   return_value=OffsetExpired):
            with self.assertRaises(OffsetExpired):
                response = view.get()