|
14 | 14 | import kombu.exceptions
|
15 | 15 | import mock
|
16 | 16 | from django.core.cache import cache
|
| 17 | +from django.http import HttpRequest |
17 | 18 |
|
18 | 19 | import tests.models
|
19 | 20 | from django_declarative_apis import machinery, models as dda_models
|
@@ -291,10 +292,15 @@ def resource(self):
|
291 | 292 | def response(self):
|
292 | 293 | return {"people": self.resource}
|
293 | 294 |
|
| 295 | + def __call__(self): |
| 296 | + return self |
| 297 | + |
294 | 298 | endpoint = _TestEndpoint()
|
295 | 299 | manager = machinery.EndpointBinder.BoundEndpointManager(
|
296 | 300 | machinery._EndpointRequestLifecycleManager(endpoint), endpoint
|
297 | 301 | )
|
| 302 | + machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest()) |
| 303 | + |
298 | 304 | status, resp = manager.get_response()
|
299 | 305 | self.assertEqual(status, http.HTTPStatus.OK)
|
300 | 306 | # make sure the list is in the expected order
|
@@ -723,6 +729,9 @@ def __init__(self, expected_response, *args, **kwargs):
|
723 | 729 | super(_TestEndpoint, self).__init__(*args, **kwargs)
|
724 | 730 | self.expected_response = expected_response
|
725 | 731 |
|
| 732 | + def __call__(self): |
| 733 | + return self |
| 734 | + |
726 | 735 | @machinery.endpoint_resource(
|
727 | 736 | type=tests.models.TestModel, filter={str: filtering.ALWAYS}
|
728 | 737 | )
|
@@ -787,6 +796,7 @@ def test_get_response_kombu_error_retried(self):
|
787 | 796 | manager = machinery.EndpointBinder.BoundEndpointManager(
|
788 | 797 | machinery._EndpointRequestLifecycleManager(endpoint), endpoint
|
789 | 798 | )
|
| 799 | + machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest()) |
790 | 800 |
|
791 | 801 | conf = tasks.future_task_runner.app.conf
|
792 | 802 | old_val = conf["task_always_eager"]
|
@@ -826,6 +836,7 @@ def test_async_task_falls_back_to_synchronous_when_configured(self):
|
826 | 836 | manager = machinery.EndpointBinder.BoundEndpointManager(
|
827 | 837 | machinery._EndpointRequestLifecycleManager(endpoint), endpoint
|
828 | 838 | )
|
| 839 | + machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest()) |
829 | 840 |
|
830 | 841 | conf = tasks.future_task_runner.app.conf
|
831 | 842 | old_val = conf["task_always_eager"]
|
@@ -854,6 +865,7 @@ def test_force_synchronous_tasks(self):
|
854 | 865 | manager = machinery.EndpointBinder.BoundEndpointManager(
|
855 | 866 | machinery._EndpointRequestLifecycleManager(endpoint), endpoint
|
856 | 867 | )
|
| 868 | + machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest()) |
857 | 869 |
|
858 | 870 | conf = tasks.future_task_runner.app.conf
|
859 | 871 | old_val = conf["task_always_eager"]
|
@@ -883,6 +895,7 @@ def test_get_response_kombu_error_attempts_exceeded(self):
|
883 | 895 | manager = machinery.EndpointBinder.BoundEndpointManager(
|
884 | 896 | machinery._EndpointRequestLifecycleManager(endpoint), endpoint
|
885 | 897 | )
|
| 898 | + machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest()) |
886 | 899 |
|
887 | 900 | conf = tasks.future_task_runner.app.conf
|
888 | 901 | old_val = conf["task_always_eager"]
|
@@ -926,6 +939,7 @@ def test_get_response_success(self):
|
926 | 939 | manager = machinery.EndpointBinder.BoundEndpointManager(
|
927 | 940 | machinery._EndpointRequestLifecycleManager(endpoint), endpoint
|
928 | 941 | )
|
| 942 | + machinery.EndpointBinder(endpoint).create_bound_endpoint(manager, HttpRequest()) |
929 | 943 |
|
930 | 944 | # can't use mock.patch.dict here because it doesn't implement the api that the unpatcher expects
|
931 | 945 | conf = tasks.future_task_runner.app.conf
|
|
0 commit comments