diff --git a/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py b/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py index 21b00f8180b0..d15b7e9de64f 100644 --- a/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py +++ b/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py @@ -61,4 +61,44 @@ async def _create_and_submit_sample_translation_jobs_async(self, async_client, j await async_client.wait_until_done(job_details.id) result_job_ids.append(job_details.id) - return result_job_ids \ No newline at end of file + return result_job_ids + + + async def _create_translation_job_with_dummy_docs_async(self, async_client, docs_count, **kwargs): + ''' + appropriated this method from another PR! #18302 + please resolve conflict before merge + keep in mind it's the exact same method + ''' + # get input parms + wait_for_job = kwargs.pop('wait', False) + language_code = kwargs.pop('language_code', "es") + + # prepare containers and test data + blob_data = Document.create_dummy_docs(docs_count=docs_count) + source_container_sas_url = self.create_source_container(data=blob_data) + target_container_sas_url = self.create_target_container() + + # prepare translation inputs + translation_inputs = [ + DocumentTranslationInput( + source_url=source_container_sas_url, + targets=[ + TranslationTarget( + target_url=target_container_sas_url, + language_code=language_code + ) + ] + ) + ] + + # submit job + job_details = await async_client.create_translation_job(translation_inputs) + self.assertIsNotNone(job_details.id) + # wait for result + if wait_for_job: + await async_client.wait_until_done(job_details.id) + # validate + self._validate_translation_job(job_details=job_details) + + return job_details.id diff --git a/sdk/translation/azure-ai-translation-document/tests/recordings/test_cancel_job.test_cancel_job.yaml b/sdk/translation/azure-ai-translation-document/tests/recordings/test_cancel_job.test_cancel_job.yaml index 2404b2554dad..2b919a8ac468 100644 --- a/sdk/translation/azure-ai-translation-document/tests/recordings/test_cancel_job.test_cancel_job.yaml +++ b/sdk/translation/azure-ai-translation-document/tests/recordings/test_cancel_job.test_cancel_job.yaml @@ -11,13 +11,13 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-storage-blob/12.8.0 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 31 Mar 2021 22:11:23 GMT + - Wed, 28 Apr 2021 01:27:34 GMT x-ms-version: - '2020-06-12' method: PUT - uri: https://redacted.blob.core.windows.net/srcedb6c15d-00da-46ce-ad32-64ccc2a932f7?restype=container + uri: https://redacted.blob.core.windows.net/src40ea349b-a66b-41d0-b606-6dc0bb9a8f7b?restype=container response: body: string: '' @@ -25,11 +25,11 @@ interactions: content-length: - '0' date: - - Wed, 31 Mar 2021 22:11:22 GMT + - Wed, 28 Apr 2021 01:27:34 GMT etag: - - '"0x8D8F491EBAF77E3"' + - '"0x8D909E4CD532595"' last-modified: - - Wed, 31 Mar 2021 22:11:23 GMT + - Wed, 28 Apr 2021 01:27:35 GMT server: - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -38,7 +38,7 @@ interactions: code: 201 message: Created - request: - body: This is some text + body: This is written in english. headers: Accept: - application/xml @@ -47,23 +47,21 @@ interactions: Connection: - keep-alive Content-Length: - - '17' + - '27' Content-Type: - application/octet-stream If-None-Match: - '*' User-Agent: - - azsdk-python-storage-blob/12.8.0 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) x-ms-blob-type: - BlockBlob x-ms-date: - - Wed, 31 Mar 2021 22:11:24 GMT - x-ms-encryption-algorithm: - - AES256 + - Wed, 28 Apr 2021 01:27:35 GMT x-ms-version: - '2020-06-12' method: PUT - uri: https://redacted.blob.core.windows.net/srcedb6c15d-00da-46ce-ad32-64ccc2a932f7/e5a39f28-813a-4bc9-920e-78b5a009655a.txt + uri: https://redacted.blob.core.windows.net/src40ea349b-a66b-41d0-b606-6dc0bb9a8f7b/bbcd7bd2-b37e-42b6-9412-10394bdda5c7.txt response: body: string: '' @@ -71,17 +69,367 @@ interactions: content-length: - '0' content-md5: - - lyFPYyJLwenMTaN3qtznxw== + - mYgA0QpY6baiB+xZp8Hk+A== date: - - Wed, 31 Mar 2021 22:11:22 GMT + - Wed, 28 Apr 2021 01:27:34 GMT etag: - - '"0x8D8F491EBD784FB"' + - '"0x8D909E4CD80B72A"' last-modified: - - Wed, 31 Mar 2021 22:11:23 GMT + - Wed, 28 Apr 2021 01:27:35 GMT server: - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-content-crc64: - - SqmNKeH10UQ= + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:27:36 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/src40ea349b-a66b-41d0-b606-6dc0bb9a8f7b/d0863009-986b-4fb5-bac6-31f3807cecca.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:27:34 GMT + etag: + - '"0x8D909E4CDA66E7C"' + last-modified: + - Wed, 28 Apr 2021 01:27:35 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:27:36 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/src40ea349b-a66b-41d0-b606-6dc0bb9a8f7b/a4f7e9b1-ba6c-451f-bc15-6f5db16d6c10.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:27:35 GMT + etag: + - '"0x8D909E4CDD3EF70"' + last-modified: + - Wed, 28 Apr 2021 01:27:36 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:27:36 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/src40ea349b-a66b-41d0-b606-6dc0bb9a8f7b/b9ed0908-ff2c-4e91-a680-2119d28a358f.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:27:35 GMT + etag: + - '"0x8D909E4CDF73546"' + last-modified: + - Wed, 28 Apr 2021 01:27:36 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:27:36 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/src40ea349b-a66b-41d0-b606-6dc0bb9a8f7b/4e194e21-ac39-4ec6-b14c-5c521d313944.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:27:35 GMT + etag: + - '"0x8D909E4CE1A5411"' + last-modified: + - Wed, 28 Apr 2021 01:27:36 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:27:37 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/src40ea349b-a66b-41d0-b606-6dc0bb9a8f7b/d9fba13c-658b-4763-97af-8db4afb05ba8.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:27:35 GMT + etag: + - '"0x8D909E4CE3D99F2"' + last-modified: + - Wed, 28 Apr 2021 01:27:36 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:27:37 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/src40ea349b-a66b-41d0-b606-6dc0bb9a8f7b/85919279-7859-4e02-b1d8-83418a3890da.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:27:36 GMT + etag: + - '"0x8D909E4CE612E0F"' + last-modified: + - Wed, 28 Apr 2021 01:27:36 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:27:37 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/src40ea349b-a66b-41d0-b606-6dc0bb9a8f7b/7fcd85d9-f6b2-47ef-bf03-b576c365198e.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:27:36 GMT + etag: + - '"0x8D909E4CE88454D"' + last-modified: + - Wed, 28 Apr 2021 01:27:37 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= x-ms-request-server-encrypted: - 'true' x-ms-version: @@ -101,13 +449,13 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-storage-blob/12.8.0 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 31 Mar 2021 22:11:24 GMT + - Wed, 28 Apr 2021 01:27:37 GMT x-ms-version: - '2020-06-12' method: PUT - uri: https://redacted.blob.core.windows.net/target1c4bfa9d-0bef-4e33-b53f-08920f65aba0?restype=container + uri: https://redacted.blob.core.windows.net/targeted53dc7d-d00e-43e6-90ac-9f5d3eeb35e1?restype=container response: body: string: '' @@ -115,11 +463,11 @@ interactions: content-length: - '0' date: - - Wed, 31 Mar 2021 22:11:24 GMT + - Wed, 28 Apr 2021 01:27:37 GMT etag: - - '"0x8D8F491EC6D72C0"' + - '"0x8D909E4CF1E9076"' last-modified: - - Wed, 31 Mar 2021 22:11:24 GMT + - Wed, 28 Apr 2021 01:27:38 GMT server: - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -128,8 +476,8 @@ interactions: code: 201 message: Created - request: - body: '{"inputs": [{"source": {"sourceUrl": "https://redacted.blob.core.windows.net/srcedb6c15d-00da-46ce-ad32-64ccc2a932f7?se=end&sp=rl&sv=2020-06-12&sr=c&sig=fake_token_value", - "filter": {}}, "targets": [{"targetUrl": "https://redacted.blob.core.windows.net/target1c4bfa9d-0bef-4e33-b53f-08920f65aba0?se=end&sp=racwdl&sv=2020-06-12&sr=c&sig=fake_token_value", + body: '{"inputs": [{"source": {"sourceUrl": "https://redacted.blob.core.windows.net/src40ea349b-a66b-41d0-b606-6dc0bb9a8f7b?se=end&sp=rl&sv=2020-06-12&sr=c&sig=fake_token_value", + "filter": {}}, "targets": [{"targetUrl": "https://redacted.blob.core.windows.net/targeted53dc7d-d00e-43e6-90ac-9f5d3eeb35e1?se=end&sp=rw&sv=2020-06-12&sr=c&sig=fake_token_value", "language": "es"}]}]}' headers: Accept: @@ -139,11 +487,11 @@ interactions: Connection: - keep-alive Content-Length: - - '494' + - '486' Content-Type: - application/json User-Agent: - - azsdk-python-ai-translatortext/1.0.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-translation-document/1.0.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0) method: POST uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches response: @@ -151,13 +499,13 @@ interactions: string: '' headers: apim-request-id: - - f20ef90c-230a-40d2-b02c-4934cefb6515 + - 80b397b4-8830-4650-845d-a8afe7afe5b5 content-length: - '0' date: - - Wed, 31 Mar 2021 22:11:25 GMT + - Wed, 28 Apr 2021 01:27:38 GMT operation-location: - - https://redacted.cognitiveservices.azure.com/translatortext/batch/v1.0-preview.1/batches/babdaa50-84a5-4fba-8f43-57e4e128f65b + - https://redacted.cognitiveservices.azure.com/translatortext/batch/v1.0-preview.1/batches/c786e8e7-79fb-4bfa-8059-b17cf1b52ef8 set-cookie: - ARRAffinity=52534756bc24481c0848ee2def3c54a057fd0e51707d9dcf782aa603bbaa9f24;Path=/;HttpOnly;Secure;Domain=doctrans.northeu.microsofttranslator.com - ARRAffinitySameSite=52534756bc24481c0848ee2def3c54a057fd0e51707d9dcf782aa603bbaa9f24;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com @@ -168,7 +516,7 @@ interactions: x-powered-by: - ASP.NET x-requestid: - - f20ef90c-230a-40d2-b02c-4934cefb6515 + - 80b397b4-8830-4650-845d-a8afe7afe5b5 status: code: 202 message: Accepted @@ -182,15 +530,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-ai-translatortext/1.0.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-translation-document/1.0.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0) method: GET - uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/babdaa50-84a5-4fba-8f43-57e4e128f65b + uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/c786e8e7-79fb-4bfa-8059-b17cf1b52ef8 response: body: - string: '{"id":"babdaa50-84a5-4fba-8f43-57e4e128f65b","createdDateTimeUtc":"2021-03-31T22:11:25.7581744Z","lastActionDateTimeUtc":"2021-03-31T22:11:25.7581748Z","status":"NotStarted","summary":{"total":0,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":0,"totalCharacterCharged":0}}' + string: '{"id":"c786e8e7-79fb-4bfa-8059-b17cf1b52ef8","createdDateTimeUtc":"2021-04-28T01:27:39.1323259Z","lastActionDateTimeUtc":"2021-04-28T01:27:39.1323263Z","status":"NotStarted","summary":{"total":0,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":0,"totalCharacterCharged":0}}' headers: apim-request-id: - - 8b437bce-fa11-4232-bf76-6487da989644 + - ccfc70b3-3c85-4c02-8455-74cb209299d8 cache-control: - public,max-age=1 content-length: @@ -198,12 +546,12 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 31 Mar 2021 22:11:25 GMT + - Wed, 28 Apr 2021 01:27:38 GMT etag: - - '"5DE983D38BA78EC0C1A65417C311CA90E14409A64AFA2493F63F816C1EDEFB1C"' + - '"7784822B509A23305B874611A2C284335AEC0163B40D35558D0E2C36C127D4BA"' set-cookie: - - ARRAffinity=36da0e643e19b219e9cc242244bbb17606f2f9cdc98871c377756b22cded58cb;Path=/;HttpOnly;Secure;Domain=doctrans.northeu.microsofttranslator.com - - ARRAffinitySameSite=36da0e643e19b219e9cc242244bbb17606f2f9cdc98871c377756b22cded58cb;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com + - ARRAffinity=b85bad1b8326b1376e60e99b410c1da9c99b2e137606973a71315f97deb3a0ce;Path=/;HttpOnly;Secure;Domain=doctrans.northeu.microsofttranslator.com + - ARRAffinitySameSite=b85bad1b8326b1376e60e99b410c1da9c99b2e137606973a71315f97deb3a0ce;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -215,7 +563,7 @@ interactions: x-powered-by: - ASP.NET x-requestid: - - 8b437bce-fa11-4232-bf76-6487da989644 + - ccfc70b3-3c85-4c02-8455-74cb209299d8 status: code: 200 message: OK @@ -231,21 +579,21 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-ai-translatortext/1.0.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-translation-document/1.0.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0) method: DELETE - uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/babdaa50-84a5-4fba-8f43-57e4e128f65b + uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/c786e8e7-79fb-4bfa-8059-b17cf1b52ef8 response: body: - string: '{"id":"babdaa50-84a5-4fba-8f43-57e4e128f65b","createdDateTimeUtc":"2021-03-31T22:11:25.7581744Z","lastActionDateTimeUtc":"2021-03-31T22:11:26.0497877Z","status":"NotStarted","summary":{"total":0,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":0,"totalCharacterCharged":0}}' + string: '{"id":"c786e8e7-79fb-4bfa-8059-b17cf1b52ef8","createdDateTimeUtc":"2021-04-28T01:27:39.1323259Z","lastActionDateTimeUtc":"2021-04-28T01:27:39.5145035Z","status":"NotStarted","summary":{"total":0,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":0,"totalCharacterCharged":0}}' headers: apim-request-id: - - 5f98f32c-99d1-421f-9df9-0e1ba1105f32 + - efbc5e17-2fa1-4729-b38d-644599ed6937 content-length: - '292' content-type: - application/json; charset=utf-8 date: - - Wed, 31 Mar 2021 22:11:25 GMT + - Wed, 28 Apr 2021 01:27:38 GMT set-cookie: - ARRAffinity=52534756bc24481c0848ee2def3c54a057fd0e51707d9dcf782aa603bbaa9f24;Path=/;HttpOnly;Secure;Domain=doctrans.northeu.microsofttranslator.com - ARRAffinitySameSite=52534756bc24481c0848ee2def3c54a057fd0e51707d9dcf782aa603bbaa9f24;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com @@ -260,7 +608,7 @@ interactions: x-powered-by: - ASP.NET x-requestid: - - 5f98f32c-99d1-421f-9df9-0e1ba1105f32 + - efbc5e17-2fa1-4729-b38d-644599ed6937 status: code: 200 message: OK @@ -274,15 +622,15 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-ai-translatortext/1.0.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-translation-document/1.0.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0) method: GET - uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/babdaa50-84a5-4fba-8f43-57e4e128f65b + uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/c786e8e7-79fb-4bfa-8059-b17cf1b52ef8 response: body: - string: '{"id":"babdaa50-84a5-4fba-8f43-57e4e128f65b","createdDateTimeUtc":"2021-03-31T22:11:25.7581744Z","lastActionDateTimeUtc":"2021-03-31T22:11:34.5155332Z","status":"Cancelled","summary":{"total":1,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":1,"totalCharacterCharged":0}}' + string: '{"id":"c786e8e7-79fb-4bfa-8059-b17cf1b52ef8","createdDateTimeUtc":"2021-04-28T01:27:39.1323259Z","lastActionDateTimeUtc":"2021-04-28T01:27:48.4229222Z","status":"Cancelled","summary":{"total":8,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":8,"totalCharacterCharged":0}}' headers: apim-request-id: - - 026bce90-37d4-4eb1-9bdf-9bb3c6e2b888 + - b5aea7d7-45b9-4c31-b63a-72372277c00a cache-control: - public,max-age=1 content-length: @@ -290,12 +638,12 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 31 Mar 2021 22:11:35 GMT + - Wed, 28 Apr 2021 01:27:54 GMT etag: - - '"6E869F5BA7FA3E66A95EB408B2E8A5DCDA3782ED68E105EBBCD8056B49F7C5EF"' + - '"DD5B94727512163C8CC772144E697488E247BD745B0C36E56FC8931D444A98C5"' set-cookie: - - ARRAffinity=36da0e643e19b219e9cc242244bbb17606f2f9cdc98871c377756b22cded58cb;Path=/;HttpOnly;Secure;Domain=doctrans.northeu.microsofttranslator.com - - ARRAffinitySameSite=36da0e643e19b219e9cc242244bbb17606f2f9cdc98871c377756b22cded58cb;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com + - ARRAffinity=b85bad1b8326b1376e60e99b410c1da9c99b2e137606973a71315f97deb3a0ce;Path=/;HttpOnly;Secure;Domain=doctrans.northeu.microsofttranslator.com + - ARRAffinitySameSite=b85bad1b8326b1376e60e99b410c1da9c99b2e137606973a71315f97deb3a0ce;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -307,7 +655,7 @@ interactions: x-powered-by: - ASP.NET x-requestid: - - 026bce90-37d4-4eb1-9bdf-9bb3c6e2b888 + - b5aea7d7-45b9-4c31-b63a-72372277c00a status: code: 200 message: OK diff --git a/sdk/translation/azure-ai-translation-document/tests/recordings/test_cancel_job_async.test_cancel_job.yaml b/sdk/translation/azure-ai-translation-document/tests/recordings/test_cancel_job_async.test_cancel_job.yaml index 0890ad715ae4..944b04297ec5 100644 --- a/sdk/translation/azure-ai-translation-document/tests/recordings/test_cancel_job_async.test_cancel_job.yaml +++ b/sdk/translation/azure-ai-translation-document/tests/recordings/test_cancel_job_async.test_cancel_job.yaml @@ -11,13 +11,13 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-storage-blob/12.8.0 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 31 Mar 2021 22:11:36 GMT + - Wed, 28 Apr 2021 01:27:59 GMT x-ms-version: - '2020-06-12' method: PUT - uri: https://redacted.blob.core.windows.net/src5581eb1d-a1d2-4ab9-b911-a40e5ba58fd2?restype=container + uri: https://redacted.blob.core.windows.net/srcc414cf99-5cd7-4678-8293-beb80288f14d?restype=container response: body: string: '' @@ -25,11 +25,11 @@ interactions: content-length: - '0' date: - - Wed, 31 Mar 2021 22:11:37 GMT + - Wed, 28 Apr 2021 01:27:59 GMT etag: - - '"0x8D8F491F3E86DD7"' + - '"0x8D909E4DC25E30E"' last-modified: - - Wed, 31 Mar 2021 22:11:37 GMT + - Wed, 28 Apr 2021 01:28:00 GMT server: - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -38,7 +38,7 @@ interactions: code: 201 message: Created - request: - body: This is some text + body: This is written in english. headers: Accept: - application/xml @@ -47,23 +47,21 @@ interactions: Connection: - keep-alive Content-Length: - - '17' + - '27' Content-Type: - application/octet-stream If-None-Match: - '*' User-Agent: - - azsdk-python-storage-blob/12.8.0 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) x-ms-blob-type: - BlockBlob x-ms-date: - - Wed, 31 Mar 2021 22:11:38 GMT - x-ms-encryption-algorithm: - - AES256 + - Wed, 28 Apr 2021 01:28:00 GMT x-ms-version: - '2020-06-12' method: PUT - uri: https://redacted.blob.core.windows.net/src5581eb1d-a1d2-4ab9-b911-a40e5ba58fd2/98d332c2-c8fa-4eea-a31b-fbe2c0c02caf.txt + uri: https://redacted.blob.core.windows.net/srcc414cf99-5cd7-4678-8293-beb80288f14d/d10af2bb-e3ad-481b-9f11-ee7d7ba122c5.txt response: body: string: '' @@ -71,17 +69,367 @@ interactions: content-length: - '0' content-md5: - - lyFPYyJLwenMTaN3qtznxw== + - mYgA0QpY6baiB+xZp8Hk+A== date: - - Wed, 31 Mar 2021 22:11:37 GMT + - Wed, 28 Apr 2021 01:27:59 GMT etag: - - '"0x8D8F491F42387CF"' + - '"0x8D909E4DC4C0F05"' last-modified: - - Wed, 31 Mar 2021 22:11:37 GMT + - Wed, 28 Apr 2021 01:28:00 GMT server: - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-content-crc64: - - SqmNKeH10UQ= + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:28:00 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/srcc414cf99-5cd7-4678-8293-beb80288f14d/7dc608e1-72f5-469a-b821-ce7f3cddd428.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:27:59 GMT + etag: + - '"0x8D909E4DC732629"' + last-modified: + - Wed, 28 Apr 2021 01:28:00 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:28:01 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/srcc414cf99-5cd7-4678-8293-beb80288f14d/c837d10b-a003-4701-8b2a-124d55b653e6.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:28:00 GMT + etag: + - '"0x8D909E4DC961DE8"' + last-modified: + - Wed, 28 Apr 2021 01:28:00 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:28:01 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/srcc414cf99-5cd7-4678-8293-beb80288f14d/5c6347e2-a586-49d9-9f9a-7bec1b8c468d.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:28:00 GMT + etag: + - '"0x8D909E4DCB915A0"' + last-modified: + - Wed, 28 Apr 2021 01:28:00 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:28:01 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/srcc414cf99-5cd7-4678-8293-beb80288f14d/a09dd93f-ba91-401e-bd50-de6006650217.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:28:00 GMT + etag: + - '"0x8D909E4DCE22909"' + last-modified: + - Wed, 28 Apr 2021 01:28:01 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:28:01 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/srcc414cf99-5cd7-4678-8293-beb80288f14d/c20056ed-88e7-46ca-bfa0-1f10ee05441e.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:28:00 GMT + etag: + - '"0x8D909E4DD0520C5"' + last-modified: + - Wed, 28 Apr 2021 01:28:01 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:28:02 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/srcc414cf99-5cd7-4678-8293-beb80288f14d/fe9b644e-017e-4478-b2a9-f46046eb96c1.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:28:01 GMT + etag: + - '"0x8D909E4DD2A62CA"' + last-modified: + - Wed, 28 Apr 2021 01:28:01 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= + x-ms-request-server-encrypted: + - 'true' + x-ms-version: + - '2020-06-12' + status: + code: 201 + message: Created +- request: + body: This is written in english. + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '27' + Content-Type: + - application/octet-stream + If-None-Match: + - '*' + User-Agent: + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + x-ms-blob-type: + - BlockBlob + x-ms-date: + - Wed, 28 Apr 2021 01:28:02 GMT + x-ms-version: + - '2020-06-12' + method: PUT + uri: https://redacted.blob.core.windows.net/srcc414cf99-5cd7-4678-8293-beb80288f14d/66615579-aefa-43a9-80b1-7bd68a80c66a.txt + response: + body: + string: '' + headers: + content-length: + - '0' + content-md5: + - mYgA0QpY6baiB+xZp8Hk+A== + date: + - Wed, 28 Apr 2021 01:28:01 GMT + etag: + - '"0x8D909E4DD5F864F"' + last-modified: + - Wed, 28 Apr 2021 01:28:02 GMT + server: + - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 + x-ms-content-crc64: + - NB4xBtawP6g= x-ms-request-server-encrypted: - 'true' x-ms-version: @@ -101,13 +449,13 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-storage-blob/12.8.0 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-storage-blob/12.8.1 Python/3.9.0 (Windows-10-10.0.19041-SP0) x-ms-date: - - Wed, 31 Mar 2021 22:11:38 GMT + - Wed, 28 Apr 2021 01:28:02 GMT x-ms-version: - '2020-06-12' method: PUT - uri: https://redacted.blob.core.windows.net/targetc9e47cea-0932-4971-8e19-b6fb283c26a1?restype=container + uri: https://redacted.blob.core.windows.net/targetd3259d95-9779-4db1-94e8-ad99df1e15bd?restype=container response: body: string: '' @@ -115,11 +463,11 @@ interactions: content-length: - '0' date: - - Wed, 31 Mar 2021 22:11:38 GMT + - Wed, 28 Apr 2021 01:28:03 GMT etag: - - '"0x8D8F491F4D8AE39"' + - '"0x8D909E4DE446C47"' last-modified: - - Wed, 31 Mar 2021 22:11:38 GMT + - Wed, 28 Apr 2021 01:28:03 GMT server: - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: @@ -128,33 +476,33 @@ interactions: code: 201 message: Created - request: - body: '{"inputs": [{"source": {"sourceUrl": "https://redacted.blob.core.windows.net/src5581eb1d-a1d2-4ab9-b911-a40e5ba58fd2?se=end&sp=rl&sv=2020-06-12&sr=c&sig=fake_token_value", - "filter": {}}, "targets": [{"targetUrl": "https://redacted.blob.core.windows.net/targetc9e47cea-0932-4971-8e19-b6fb283c26a1?se=end&sp=racwdl&sv=2020-06-12&sr=c&sig=fake_token_value", + body: '{"inputs": [{"source": {"sourceUrl": "https://redacted.blob.core.windows.net/srcc414cf99-5cd7-4678-8293-beb80288f14d?se=end&sp=rl&sv=2020-06-12&sr=c&sig=fake_token_value", + "filter": {}}, "targets": [{"targetUrl": "https://redacted.blob.core.windows.net/targetd3259d95-9779-4db1-94e8-ad99df1e15bd?se=end&sp=rw&sv=2020-06-12&sr=c&sig=fake_token_value", "language": "es"}]}]}' headers: Accept: - application/json Content-Length: - - '488' + - '486' Content-Type: - application/json User-Agent: - - azsdk-python-ai-translatortext/1.0.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-translation-document/1.0.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0) method: POST uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches response: body: string: '' headers: - apim-request-id: 9f7445a4-2e7b-46c3-9ab0-25e085cae212 + apim-request-id: 0b5d5b37-71b7-443d-9f46-919c998f9773 content-length: '0' - date: Wed, 31 Mar 2021 22:11:39 GMT - operation-location: https://redacted.cognitiveservices.azure.com/translatortext/batch/v1.0-preview.1/batches/ae0d0fd0-c9fd-4395-b8ed-4592c6a3660a - set-cookie: ARRAffinitySameSite=36da0e643e19b219e9cc242244bbb17606f2f9cdc98871c377756b22cded58cb;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com + date: Wed, 28 Apr 2021 01:28:04 GMT + operation-location: https://redacted.cognitiveservices.azure.com/translatortext/batch/v1.0-preview.1/batches/72bc3e84-4918-4f8e-8668-d1d6f35c9967 + set-cookie: ARRAffinitySameSite=52534756bc24481c0848ee2def3c54a057fd0e51707d9dcf782aa603bbaa9f24;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff x-powered-by: ASP.NET - x-requestid: 9f7445a4-2e7b-46c3-9ab0-25e085cae212 + x-requestid: 0b5d5b37-71b7-443d-9f46-919c998f9773 status: code: 202 message: Accepted @@ -165,86 +513,86 @@ interactions: Accept: - application/json User-Agent: - - azsdk-python-ai-translatortext/1.0.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-translation-document/1.0.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0) method: GET - uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/ae0d0fd0-c9fd-4395-b8ed-4592c6a3660a + uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/72bc3e84-4918-4f8e-8668-d1d6f35c9967 response: body: - string: '{"id":"ae0d0fd0-c9fd-4395-b8ed-4592c6a3660a","createdDateTimeUtc":"2021-03-31T22:11:39.5435572Z","lastActionDateTimeUtc":"2021-03-31T22:11:39.5435575Z","status":"NotStarted","summary":{"total":0,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":0,"totalCharacterCharged":0}}' + string: '{"id":"72bc3e84-4918-4f8e-8668-d1d6f35c9967","createdDateTimeUtc":"2021-04-28T01:28:04.7317654Z","lastActionDateTimeUtc":"2021-04-28T01:28:04.7317657Z","status":"NotStarted","summary":{"total":0,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":0,"totalCharacterCharged":0}}' headers: - apim-request-id: 800ca70e-2f43-4c2d-a69d-68118caca0e3 + apim-request-id: 26d7f222-b157-4ccc-b17e-cc30ddb4f7dd cache-control: public,max-age=1 content-encoding: gzip content-type: application/json; charset=utf-8 - date: Wed, 31 Mar 2021 22:11:39 GMT - etag: '"54AAE1CE5AFCDB3E997BEC91F3CF0887DF5D3EEAE67E5F8F3446C916D1E695C3"' - set-cookie: ARRAffinitySameSite=52534756bc24481c0848ee2def3c54a057fd0e51707d9dcf782aa603bbaa9f24;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com + date: Wed, 28 Apr 2021 01:28:04 GMT + etag: '"0947EFB356635C148832AECE90726BEECD4EE4F8E841E3D3B77D45755B02D11F"' + set-cookie: ARRAffinitySameSite=b85bad1b8326b1376e60e99b410c1da9c99b2e137606973a71315f97deb3a0ce;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked vary: Accept-Encoding x-content-type-options: nosniff x-powered-by: ASP.NET - x-requestid: 800ca70e-2f43-4c2d-a69d-68118caca0e3 + x-requestid: 26d7f222-b157-4ccc-b17e-cc30ddb4f7dd status: code: 200 message: OK - url: https://redacted.cognitiveservices.azure.com/translatortext/batch/v1.0-preview.1/batches/ae0d0fd0-c9fd-4395-b8ed-4592c6a3660a + url: https://redacted.cognitiveservices.azure.com/translatortext/batch/v1.0-preview.1/batches/72bc3e84-4918-4f8e-8668-d1d6f35c9967 - request: body: null headers: Accept: - application/json User-Agent: - - azsdk-python-ai-translatortext/1.0.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-translation-document/1.0.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0) method: DELETE - uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/ae0d0fd0-c9fd-4395-b8ed-4592c6a3660a + uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/72bc3e84-4918-4f8e-8668-d1d6f35c9967 response: body: - string: '{"id":"ae0d0fd0-c9fd-4395-b8ed-4592c6a3660a","createdDateTimeUtc":"2021-03-31T22:11:39.5435572Z","lastActionDateTimeUtc":"2021-03-31T22:11:39.8148933Z","status":"NotStarted","summary":{"total":0,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":0,"totalCharacterCharged":0}}' + string: '{"id":"72bc3e84-4918-4f8e-8668-d1d6f35c9967","createdDateTimeUtc":"2021-04-28T01:28:04.7317654Z","lastActionDateTimeUtc":"2021-04-28T01:28:05.0754376Z","status":"NotStarted","summary":{"total":0,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":0,"totalCharacterCharged":0}}' headers: - apim-request-id: 6a6a3731-d4a5-4d7a-9fdb-fb0fc5cb840b + apim-request-id: 8527b877-7a79-490b-aa07-74a64bd986fa content-encoding: gzip content-type: application/json; charset=utf-8 - date: Wed, 31 Mar 2021 22:11:39 GMT - set-cookie: ARRAffinitySameSite=36da0e643e19b219e9cc242244bbb17606f2f9cdc98871c377756b22cded58cb;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com + date: Wed, 28 Apr 2021 01:28:05 GMT + set-cookie: ARRAffinitySameSite=52534756bc24481c0848ee2def3c54a057fd0e51707d9dcf782aa603bbaa9f24;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked vary: Accept-Encoding x-content-type-options: nosniff x-powered-by: ASP.NET - x-requestid: 6a6a3731-d4a5-4d7a-9fdb-fb0fc5cb840b + x-requestid: 8527b877-7a79-490b-aa07-74a64bd986fa status: code: 200 message: OK - url: https://redacted.cognitiveservices.azure.com/translatortext/batch/v1.0-preview.1/batches/ae0d0fd0-c9fd-4395-b8ed-4592c6a3660a + url: https://redacted.cognitiveservices.azure.com/translatortext/batch/v1.0-preview.1/batches/72bc3e84-4918-4f8e-8668-d1d6f35c9967 - request: body: null headers: Accept: - application/json User-Agent: - - azsdk-python-ai-translatortext/1.0.0b1 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-translation-document/1.0.0b2 Python/3.9.0 (Windows-10-10.0.19041-SP0) method: GET - uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/ae0d0fd0-c9fd-4395-b8ed-4592c6a3660a + uri: https://redacted.cognitiveservices.azure.com/translator/text/batch/v1.0-preview.1/batches/72bc3e84-4918-4f8e-8668-d1d6f35c9967 response: body: - string: '{"id":"ae0d0fd0-c9fd-4395-b8ed-4592c6a3660a","createdDateTimeUtc":"2021-03-31T22:11:39.5435572Z","lastActionDateTimeUtc":"2021-03-31T22:11:42.5634346Z","status":"Cancelled","summary":{"total":1,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":1,"totalCharacterCharged":0}}' + string: '{"id":"72bc3e84-4918-4f8e-8668-d1d6f35c9967","createdDateTimeUtc":"2021-04-28T01:28:04.7317654Z","lastActionDateTimeUtc":"2021-04-28T01:28:13.5792944Z","status":"Cancelled","summary":{"total":8,"failed":0,"success":0,"inProgress":0,"notYetStarted":0,"cancelled":8,"totalCharacterCharged":0}}' headers: - apim-request-id: bf2af61f-38b6-4339-8675-60d950aef769 + apim-request-id: 35456b0e-df90-4eb4-9dbf-6b0b6f276030 cache-control: public,max-age=1 content-encoding: gzip content-type: application/json; charset=utf-8 - date: Wed, 31 Mar 2021 22:11:49 GMT - etag: '"F15C707AB10138CA2D406D82CBB460E082779A9049EBFBEDA0B77798EF0664F2"' + date: Wed, 28 Apr 2021 01:28:20 GMT + etag: '"748D8BB278E75FDEECF8672D5AE3DC3C5DF8DC8E060C16DB53B94FC1E4846B83"' set-cookie: ARRAffinitySameSite=52534756bc24481c0848ee2def3c54a057fd0e51707d9dcf782aa603bbaa9f24;Path=/;HttpOnly;SameSite=None;Secure;Domain=doctrans.northeu.microsofttranslator.com strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked vary: Accept-Encoding x-content-type-options: nosniff x-powered-by: ASP.NET - x-requestid: bf2af61f-38b6-4339-8675-60d950aef769 + x-requestid: 35456b0e-df90-4eb4-9dbf-6b0b6f276030 status: code: 200 message: OK - url: https://redacted.cognitiveservices.azure.com/translatortext/batch/v1.0-preview.1/batches/ae0d0fd0-c9fd-4395-b8ed-4592c6a3660a + url: https://redacted.cognitiveservices.azure.com/translatortext/batch/v1.0-preview.1/batches/72bc3e84-4918-4f8e-8668-d1d6f35c9967 version: 1 diff --git a/sdk/translation/azure-ai-translation-document/tests/test_cancel_job.py b/sdk/translation/azure-ai-translation-document/tests/test_cancel_job.py index 1c837db214b4..a58eb3ad4e1c 100644 --- a/sdk/translation/azure-ai-translation-document/tests/test_cancel_job.py +++ b/sdk/translation/azure-ai-translation-document/tests/test_cancel_job.py @@ -17,32 +17,25 @@ class TestCancelJob(DocumentTranslationTest): @DocumentTranslationPreparer() @DocumentTranslationClientPreparer() def test_cancel_job(self, client): - # prepare containers and test data - blob_data = [Document(data=b'This is some text')] - source_container_sas_url = self.create_source_container(data=blob_data) - target_container_sas_url = self.create_target_container() - - # prepare translation inputs - translation_inputs = [ - DocumentTranslationInput( - source_url=source_container_sas_url, - targets=[ - TranslationTarget( - target_url=target_container_sas_url, - language_code="es" - ) - ] - ) - ] - - # submit job - job_details = client.create_translation_job(translation_inputs) - self.assertIsNotNone(job_details.id) + ''' + some notes (test sporadically failing): + 1. use a large number of jobs + - because when running tests the job sometimes finishes with status 'Succeeded' + before we call the 'cancel' endpoint! + 2. wait sometime after calling 'cancel' and before calling 'get status' + - in order for the cancel status to propagate + ''' + # submit translation job + docs_count = 8 # large number of docs + job_id = self._create_translation_job_with_dummy_docs(client, docs_count, wait=False) # cancel job - client.cancel_job(job_details.id) - self.wait(duration=10) # for 'cancelled' status to propagate, if test failed, increase this value! + client.cancel_job(job_id) + + # wait for propagation + wait_time = 15 # for 'cancelled' status to propagate, if test failed, increase this value! + self.wait(duration=wait_time) # check job status - job_details = client.get_job_status(job_details.id) - self._validate_translation_job(job_details, status="Cancelled", total=1, cancelled=1) \ No newline at end of file + job_details = client.get_job_status(job_id) + self._validate_translation_job(job_details, status="Cancelled", total=docs_count) \ No newline at end of file diff --git a/sdk/translation/azure-ai-translation-document/tests/test_cancel_job_async.py b/sdk/translation/azure-ai-translation-document/tests/test_cancel_job_async.py index 89c7dcac497a..30df07fe83b9 100644 --- a/sdk/translation/azure-ai-translation-document/tests/test_cancel_job_async.py +++ b/sdk/translation/azure-ai-translation-document/tests/test_cancel_job_async.py @@ -18,32 +18,25 @@ class TestCancelJob(AsyncDocumentTranslationTest): @DocumentTranslationPreparer() @DocumentTranslationClientPreparer() async def test_cancel_job(self, client): - # prepare containers and test data - blob_data = [Document(data=b'This is some text')] - source_container_sas_url = self.create_source_container(data=blob_data) - target_container_sas_url = self.create_target_container() - - # prepare translation inputs - translation_inputs = [ - DocumentTranslationInput( - source_url=source_container_sas_url, - targets=[ - TranslationTarget( - target_url=target_container_sas_url, - language_code="es" - ) - ] - ) - ] - - # submit job - job_details = await client.create_translation_job(translation_inputs) - self.assertIsNotNone(job_details.id) + ''' + some notes (test sporadically failing): + 1. use a large number of jobs + - because when running tests the job sometimes finishes with status 'Succeeded' + before we call the 'cancel' endpoint! + 2. wait sometime after calling 'cancel' and before calling 'get status' + - in order for the cancel status to propagate + ''' + # submit translation job + docs_count = 8 # large number of docs + job_id = await self._create_translation_job_with_dummy_docs_async(client, docs_count, wait=False) # cancel job - await client.cancel_job(job_details.id) - self.wait(duration=10) # for 'cancelled' status to propagate + await client.cancel_job(job_id) + + # wait for propagation + wait_time = 15 # for 'cancelled' status to propagate, if test failed, increase this value! + self.wait(duration=wait_time) # check job status - job_details = await client.get_job_status(job_details.id) - self._validate_translation_job(job_details, status="Cancelled", total=1, cancelled=1) \ No newline at end of file + job_details = await client.get_job_status(job_id) + self._validate_translation_job(job_details, status="Cancelled", total=docs_count) \ No newline at end of file diff --git a/sdk/translation/azure-ai-translation-document/tests/testcase.py b/sdk/translation/azure-ai-translation-document/tests/testcase.py index e7b79d4a4f63..f98ba5770d25 100644 --- a/sdk/translation/azure-ai-translation-document/tests/testcase.py +++ b/sdk/translation/azure-ai-translation-document/tests/testcase.py @@ -27,6 +27,13 @@ def __init__(self, **kwargs): self.prefix = kwargs.get("prefix", "") self.data = kwargs.get("data", b'This is written in english.') + @classmethod + def create_dummy_docs(cls, docs_count): + result = [] + for i in range(docs_count): + result.append(cls()) + return result + class OperationLocationReplacer(RecordingProcessor): """Replace the location/operation location uri in a request/response body.""" @@ -224,4 +231,44 @@ def _create_and_submit_sample_translation_jobs(self, client, jobs_count): client.wait_until_done(job_details.id) result_job_ids.append(job_details.id) - return result_job_ids \ No newline at end of file + return result_job_ids + + + def _create_translation_job_with_dummy_docs(self, client, docs_count, **kwargs): + ''' + appropriated this method from another PR! #18302 + please resolve conflict before merge + keep in mind it's the exact same method + ''' + # get input parms + wait_for_job = kwargs.pop('wait', False) + language_code = kwargs.pop('language_code', "es") + + # prepare containers and test data + blob_data = Document.create_dummy_docs(docs_count=docs_count) + source_container_sas_url = self.create_source_container(data=blob_data) + target_container_sas_url = self.create_target_container() + + # prepare translation inputs + translation_inputs = [ + DocumentTranslationInput( + source_url=source_container_sas_url, + targets=[ + TranslationTarget( + target_url=target_container_sas_url, + language_code=language_code + ) + ] + ) + ] + + # submit job + job_details = client.create_translation_job(translation_inputs) + self.assertIsNotNone(job_details.id) + # wait for result + if wait_for_job: + client.wait_until_done(job_details.id) + # validate + self._validate_translation_job(job_details=job_details) + + return job_details.id \ No newline at end of file