Skip to content

Commit b80b4d3

Browse files
committed
fix more tests
Signed-off-by: Drew Shafer <[email protected]>
1 parent 4e9ae60 commit b80b4d3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/machinery/test_base.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import kombu.exceptions
1515
import mock
1616
from django.core.cache import cache
17+
from django.http import HttpRequest
1718

1819
import tests.models
1920
from django_declarative_apis import machinery, models as dda_models
@@ -291,10 +292,15 @@ def resource(self):
291292
def response(self):
292293
return {"people": self.resource}
293294

295+
def __call__(self):
296+
return self
297+
294298
endpoint = _TestEndpoint()
295299
manager = machinery.EndpointBinder.BoundEndpointManager(
296300
machinery._EndpointRequestLifecycleManager(endpoint), endpoint
297301
)
302+
machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest())
303+
298304
status, resp = manager.get_response()
299305
self.assertEqual(status, http.HTTPStatus.OK)
300306
# make sure the list is in the expected order
@@ -723,6 +729,9 @@ def __init__(self, expected_response, *args, **kwargs):
723729
super(_TestEndpoint, self).__init__(*args, **kwargs)
724730
self.expected_response = expected_response
725731

732+
def __call__(self):
733+
return self
734+
726735
@machinery.endpoint_resource(
727736
type=tests.models.TestModel, filter={str: filtering.ALWAYS}
728737
)
@@ -787,6 +796,7 @@ def test_get_response_kombu_error_retried(self):
787796
manager = machinery.EndpointBinder.BoundEndpointManager(
788797
machinery._EndpointRequestLifecycleManager(endpoint), endpoint
789798
)
799+
machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest())
790800

791801
conf = tasks.future_task_runner.app.conf
792802
old_val = conf["task_always_eager"]
@@ -826,6 +836,7 @@ def test_async_task_falls_back_to_synchronous_when_configured(self):
826836
manager = machinery.EndpointBinder.BoundEndpointManager(
827837
machinery._EndpointRequestLifecycleManager(endpoint), endpoint
828838
)
839+
machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest())
829840

830841
conf = tasks.future_task_runner.app.conf
831842
old_val = conf["task_always_eager"]
@@ -854,6 +865,7 @@ def test_force_synchronous_tasks(self):
854865
manager = machinery.EndpointBinder.BoundEndpointManager(
855866
machinery._EndpointRequestLifecycleManager(endpoint), endpoint
856867
)
868+
machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest())
857869

858870
conf = tasks.future_task_runner.app.conf
859871
old_val = conf["task_always_eager"]
@@ -883,6 +895,7 @@ def test_get_response_kombu_error_attempts_exceeded(self):
883895
manager = machinery.EndpointBinder.BoundEndpointManager(
884896
machinery._EndpointRequestLifecycleManager(endpoint), endpoint
885897
)
898+
machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest())
886899

887900
conf = tasks.future_task_runner.app.conf
888901
old_val = conf["task_always_eager"]
@@ -926,6 +939,7 @@ def test_get_response_success(self):
926939
manager = machinery.EndpointBinder.BoundEndpointManager(
927940
machinery._EndpointRequestLifecycleManager(endpoint), endpoint
928941
)
942+
machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest())
929943

930944
# can't use mock.patch.dict here because it doesn't implement the api that the unpatcher expects
931945
conf = tasks.future_task_runner.app.conf

0 commit comments

Comments
 (0)