How to use transcribe_create_job method in localstack

Best Python code snippet using localstack_python

fixtures.py

Source: fixtures.py Github

copy

Full Screen

...539 route53_client.delete_hosted_zone(Id=zone)540 except Exception as e:541 LOG.debug(f"error cleaning up route53 HostedZone {zone}: {e}")542@pytest.fixture543def transcribe_create_job(transcribe_client, s3_client, s3_bucket):544 def _create_job(audio_file: str, params: Optional[dict[str, Any]] = None) -> str:545 s3_key = "test-clip.wav"546 if not params:547 params = {}548 if "TranscriptionJobName" not in params:549 params["TranscriptionJobName"] = f"test-transcribe-{short_uid()}"550 if "LanguageCode" not in params:551 params["LanguageCode"] = "en-GB"552 if "Media" not in params:553 params["Media"] = {"MediaFileUri": f"s3:/​/​{s3_bucket}/​{s3_key}"}554 # upload test wav to a s3 bucket555 with open(audio_file, "rb") as f:556 s3_client.upload_fileobj(f, s3_bucket, s3_key)557 transcribe_client.start_transcription_job(**params)...

Full Screen

Full Screen

test_transcribe.py

Source: test_transcribe.py Github

copy

Full Screen

...24 ]25 )26 def test_transcribe_happy_path(self, transcribe_client, transcribe_create_job, snapshot):27 file_path = os.path.join(BASEDIR, "files/​en-gb.wav")28 job_name = transcribe_create_job(audio_file=file_path)29 transcribe_client.get_transcription_job(TranscriptionJobName=job_name)30 def is_transcription_done():31 transcription_status = transcribe_client.get_transcription_job(32 TranscriptionJobName=job_name33 )34 return transcription_status["TranscriptionJob"]["TranscriptionJobStatus"] == "COMPLETED"35 # empirically it takes around36 # <5sec for a vosk transcription37 # ~100sec for an AWS transcription -> adjust timeout accordingly38 assert poll_condition(39 is_transcription_done, timeout=10040 ), f"could not finish transcription job: {job_name} in time"41 job = transcribe_client.get_transcription_job(TranscriptionJobName=job_name)42 snapshot.match("TranscriptionJob", job)43 # delete the job again44 transcribe_client.delete_transcription_job(TranscriptionJobName=job_name)45 # check if job is gone46 with pytest.raises((ClientError, NotFoundException)) as e_info:47 transcribe_client.get_transcription_job(TranscriptionJobName=job_name)48 snapshot.match("GetError", e_info.value.response)49 @pytest.mark.aws_validated50 @pytest.mark.skip_snapshot_verify(51 paths=["$..TranscriptionJob..Settings", "$..TranscriptionJob..Transcript", "$..Error..Code"]52 )53 def test_get_transcription_job(self, transcribe_client, transcribe_create_job, snapshot):54 file_path = os.path.join(BASEDIR, "files/​en-gb.wav")55 job_name = transcribe_create_job(audio_file=file_path)56 job = transcribe_client.get_transcription_job(TranscriptionJobName=job_name)57 snapshot.match("GetJob", job)58 with pytest.raises((ClientError, NotFoundException)) as e_info:59 transcribe_client.get_transcription_job(TranscriptionJobName="non-existent")60 snapshot.match("GetError", e_info.value.response)61 @pytest.mark.aws_validated62 @pytest.mark.skip_snapshot_verify(63 paths=["$..NextToken", "$..TranscriptionJobSummaries..OutputLocationType"]64 )65 def test_list_transcription_jobs(self, transcribe_client, transcribe_create_job, snapshot):66 file_path = os.path.join(BASEDIR, "files/​en-gb.wav")67 transcribe_create_job(audio_file=file_path)68 jobs = transcribe_client.list_transcription_jobs()69 # there are potentially multiple transcription jobs on AWS - ordered by creation date70 # we only care about the newest one that we just created71 jobs["TranscriptionJobSummaries"] = jobs["TranscriptionJobSummaries"][0]72 snapshot.match("ListJobs", jobs)73 @pytest.mark.aws_validated74 @pytest.mark.skip_snapshot_verify(paths=["$..Error..Code"])75 def test_failing_deletion(self, transcribe_client, snapshot):76 # successful deletion is tested in the happy path test77 # this tests a failed deletion78 with pytest.raises((ClientError, NotFoundException)) as e_info:79 transcribe_client.delete_transcription_job(TranscriptionJobName="non-existent")80 snapshot.match("MissingLanguageCode", e_info.value.response)81 @pytest.mark.aws_validated...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Complete Guide To Styling Forms With CSS Accent Color

The web paradigm has changed considerably over the last few years. Web 2.0, a term coined way back in 1999, was one of the pivotal moments in the history of the Internet. UGC (User Generated Content), ease of use, and interoperability for the end-users were the key pillars of Web 2.0. Consumers who were only consuming content up till now started creating different forms of content (e.g., text, audio, video, etc.).

20 Best VS Code Extensions For 2023

With the change in technology trends, there has been a drastic change in the way we build and develop applications. It is essential to simplify your programming requirements to achieve the desired outcomes in the long run. Visual Studio Code is regarded as one of the best IDEs for web development used by developers.

What is coaching leadership

Coaching is a term that is now being mentioned a lot more in the leadership space. Having grown successful teams I thought that I was well acquainted with this subject.

Why Agile Is Great for Your Business

Agile project management is a great alternative to traditional methods, to address the customer’s needs and the delivery of business value from the beginning of the project. This blog describes the main benefits of Agile for both the customer and the business.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful