def test_URL_post_async(self): self.app.conf.CELERY_ALWAYS_EAGER = True with mock_urlopen(success_response(100)): d = http.URL( 'http://example.com/mul', app=self.app, ).post_async(x=10, y=10) self.assertEqual(d.get(), 100)
def test_URL_post_async(self): self.app.conf.task_always_eager = True with mock_urlopen(success_response(100)): d = http.URL( 'http://example.com/mul', app=self.app, ).post_async(x=10, y=10) self.assertEqual(d.get(), 100)
def test_URL_post_async(self): http.HttpDispatchTask.app.conf.CELERY_ALWAYS_EAGER = True try: with mock_urlopen(success_response(100)): d = http.URL("http://example.com/mul").post_async(x=10, y=10) self.assertEqual(d.get(), 100) finally: http.HttpDispatchTask.app.conf.CELERY_ALWAYS_EAGER = False
def test_URL_post_async(self): with eager_tasks(): with mock_urlopen(success_response(100)): d = http.URL('http://example.com/mul').post_async(x=10, y=10) self.assertEqual(d.get(), 100)
def with_mock_urlopen(_val): d = http.URL("http://example.com/mul").post_async(x=10, y=10) self.assertEqual(d.get(), 100)