Exemple #1
0
    def test_bootstrap_worker_attaches_request_to_app(self):
        sender = mock.Mock(spec=['app'])
        request = sender.app.webapp_bootstrap.return_value

        celery.bootstrap_worker(sender)

        assert sender.app.request == request
Exemple #2
0
    def test_bootstrap_worker_configures_sentry_reporting(self,
                                                          register_signal,
                                                          register_logger_signal):
        sender = mock.Mock(spec=['app'])

        celery.bootstrap_worker(sender)

        register_signal.assert_called_once_with(mock.sentinel.sentry)
        register_logger_signal.assert_called_once_with(mock.sentinel.sentry,
                                                       loglevel=logging.ERROR)
Exemple #3
0
    def test_bootstrap_worker_bootstraps_application(self):
        sender = mock.Mock(spec=['app'])

        celery.bootstrap_worker(sender)

        sender.app.webapp_bootstrap.assert_called_once_with()
Exemple #4
0
    def test_bootstrap_worker_sets_request_root(self, paster):
        sender = mock.Mock(spec=['app'])

        celery.bootstrap_worker(sender)

        assert sender.app.request.root == mock.sentinel.root
Exemple #5
0
    def test_bootstrap_worker_attaches_request_to_app(self, paster):
        sender = mock.Mock(spec=['app'])

        celery.bootstrap_worker(sender)

        assert isinstance(sender.app.request, Request)
Exemple #6
0
    def test_bootstrap_worker_calls_paster_bootstrap(self, paster):
        sender = mock.Mock(spec=['app'])

        celery.bootstrap_worker(sender)

        assert paster.bootstrap.call_count == 1