Example #1
0
    def test_cron_handler_enqueues_task_and_does_not_redirect(self):
        handler = ImportHandler(None, Mock())
        handler.request_string = Mock(return_value='')
        handler.redirect = Mock(side_effect=RuntimeError('should not redirect'))

        handler.get()
        self.assertTasksInQueue(n=1, queue_names=UNISUBS_FETCH_Q)
        handler.request_string.assert_called_once_with('interactive')
Example #2
0
    def test_interactive_handler_enqueues_task_and_redirects(self, uuid):
        uuid.uuid4.return_value = 'UUID'
        handler = ImportHandler(None, Mock())
        handler.request_string = Mock(return_value='1')
        handler.redirect = Mock()

        handler.post()
        self.assertTasksInQueue(n=1, queue_names=UNISUBS_FETCH_Q)
        handler.request_string.assert_called_once_with('interactive')
        handler.redirect.assert_called_once_with('/admin/unisubs?_started=UUID')
Example #3
0
    def test_cron_handler_enqueues_task_and_does_not_redirect(self):
        handler = ImportHandler(None, Mock())
        handler.request_string = Mock(return_value='')
        handler.redirect = Mock(
            side_effect=RuntimeError('should not redirect'))

        handler.get()
        self.assertTasksInQueue(n=1, queue_names=UNISUBS_FETCH_Q)
        handler.request_string.assert_called_once_with('interactive')
Example #4
0
    def test_interactive_handler_enqueues_task_and_redirects(self, uuid):
        uuid.uuid4.return_value = 'UUID'
        handler = ImportHandler(None, Mock())
        handler.request_string = Mock(return_value='1')
        handler.redirect = Mock()

        handler.post()
        self.assertTasksInQueue(n=1, queue_names=UNISUBS_FETCH_Q)
        handler.request_string.assert_called_once_with('interactive')
        handler.redirect.assert_called_once_with(
            '/admin/unisubs?_started=UUID')