Best Python code snippet using localstack_python
test_e2e_client.py
Source:test_e2e_client.py
...79 self.assertEqual(status.Priority, old_priority)80 # update priority.81 self.assertRaises(ClientError, self.client.update_job_priority, job, new_priority)82 try:83 self.client.update_job_priority(job, new_priority)84 except ClientError as e:85 code = e.get_code()86 msg = e.get_msg()87 request_id = e.get_requestid()88 else:89 self.assertFalse(False, 'ClientError should be raised')90 status = self.client.get_job(job)91 if status.State in ['Waiting', 'Running']:92 self.client.stop_job(job)93 self.client.update_job_priority(job, new_priority)94 status = self.client.get_job(job)95 self.assertEqual(status.Priority, new_priority)96 def test_start_job(self):97 job_desc = self._get_job_desc()98 job = self.client.create_job(job_desc)99 self.job_id = job.JobId100 self.assertRaises(ClientError, self.client.start_job, job)101 status = self.client.get_job(job)102 if status.State in ['Waiting', 'Running']:103 self.client.stop_job(job)104 def test_list_images(self):105 image_list = self.client.list_images()106 for img in image_list:107 self.assertTrue(hasattr(img, 'ImageId'))...
change_priority.py
Source:change_priority.py
...13 print(f"WARNING: the job is not in queued state.")14 print(job)15 response = input(f"Update the priority to {new_priority}? [y/n]")16 if response == 'y':17 job_repository.update_job_priority(job_id, new_priority)18 print("Updated the job.")19def main():20 init_logging()21 env = Environment()22 parser = argparse.ArgumentParser()23 parser.add_argument('--db_url', default=env.db_url)24 parser.add_argument('job_id', type=uuid.UUID)25 parser.add_argument('new_priority', type=int)26 args = parser.parse_args()27 if not args.db_url:28 parser.error("A database url must be specified via commandline argument or environment variable.")29 change_priority(args.db_url, args.job_id, args.new_priority)30if __name__ == '__main__':31 main()
update_job_priority.py
Source:update_job_priority.py
1import djclick as click2from jobs.tasks import update_job_priority3@click.command()4@click.option("--pk", required=True)5@click.option("--new-priority", required=True)6def command(new_priority, pk):...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!