|
47 | 47 | from azure.core.pipeline import PipelineResponse, Pipeline, PipelineContext |
48 | 48 | from azure.core.pipeline.transport import HttpTransport |
49 | 49 |
|
50 | | -from azure.core.polling.base_polling import LROBasePolling |
| 50 | +from azure.core.polling.base_polling import LROBasePolling, OperationResourcePolling |
51 | 51 | from azure.core.pipeline.policies._utils import _FixedOffset |
52 | 52 | from utils import request_and_responses_product, REQUESTS_TRANSPORT_RESPONSES, create_transport_response, HTTP_REQUESTS |
53 | 53 | from azure.core.pipeline._tools import is_rest |
@@ -879,3 +879,18 @@ def test_final_get_via_location(port, http_request, deserialization_cb): |
879 | 879 | ) |
880 | 880 | result = poller.result() |
881 | 881 | assert result == {"returnedFrom": "locationHeaderUrl"} |
| 882 | + |
| 883 | +# THIS TEST WILL BE REMOVED SOON |
| 884 | +"""Weird test, but we are temporarily adding back the POST check in OperationResourcePolling |
| 885 | +get_final_get_url. With the test added back, we should not exit on final state via checks and |
| 886 | +continue through the rest of the code. Since the rest of the code requires inspection of pipeline_response |
| 887 | +and since I don't want to bother with adding a pipeline response object, just check that we get |
| 888 | +past the final state via checks |
| 889 | +""" |
| 890 | +@pytest.mark.parametrize("http_request", HTTP_REQUESTS) |
| 891 | +def test_post_check_patch(http_request): |
| 892 | + algorithm = OperationResourcePolling(lro_options={"final-state-via": "azure-async-operation"}) |
| 893 | + algorithm._request = http_request("PUT", "http://fakeurl.com") |
| 894 | + with pytest.raises(AttributeError) as ex: |
| 895 | + algorithm.get_final_get_url(None) |
| 896 | + assert "'NoneType' object has no attribute 'http_response'" in str(ex.value) |
0 commit comments