Skip to content

Commit

Permalink
make 'cancel job' tests more robust (#18329)
Browse files Browse the repository at this point in the history
* updated 'cancel job' tests

* fix some errors

* updated cancel tests

* add recorded tests
  • Loading branch information
Mohamed Shaban authored Apr 28, 2021
1 parent 8b1c366 commit 567a408
Show file tree
Hide file tree
Showing 6 changed files with 935 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
Loading

0 comments on commit 567a408

Please sign in to comment.