Best Python code snippet using localstack_python
test_secretsmanager.py
Source:test_secretsmanager.py
...385 ResourcePolicy='{\n"Version":"2012-10-17",\n"Statement":[{\n"Effect":"Allow",\n"Principal":{\n"AWS":"arn:aws:iam::123456789012:root"\n},\n"Action":"secretsmanager:GetSecretValue",\n"Resource":"*"\n}]\n}',386 )387 check_validation_exception(validation_exception)388 def test_last_accessed_date(self, sm_client):389 def last_accessed_scenario_1(fail_if_days_overlap: bool) -> bool:390 secret_name = f"s-{short_uid()}"391 sm_client.create_secret(Name=secret_name, SecretString="MySecretValue")392 des = sm_client.describe_secret(SecretId=secret_name)393 assert "LastAccessedDate" not in des394 t0 = today_no_time()395 sm_client.get_secret_value(SecretId=secret_name)396 des = sm_client.describe_secret(SecretId=secret_name)397 assert "LastAccessedDate" in des398 lad_v0 = des["LastAccessedDate"]399 assert isinstance(lad_v0, datetime)400 sm_client.get_secret_value(SecretId=secret_name)401 des = sm_client.describe_secret(SecretId=secret_name)402 assert "LastAccessedDate" in des403 lad_v1 = des["LastAccessedDate"]404 assert isinstance(lad_v1, datetime)405 if t0 == today_no_time() or fail_if_days_overlap:406 assert lad_v0 == lad_v1407 return True408 else:409 return False410 if not last_accessed_scenario_1(411 False412 ): # Test started yesterday and ended today (where relevant).413 last_accessed_scenario_1(414 True415 ) # Replay today or allow failure (this should never take longer than a day).416 def test_last_updated_date(self, sm_client):417 secret_name = f"s-{short_uid()}"418 sm_client.create_secret(Name=secret_name, SecretString="MySecretValue")419 res = sm_client.describe_secret(SecretId=secret_name)420 assert "LastChangedDate" in res421 create_date = res["LastChangedDate"]422 assert isinstance(create_date, datetime)423 res = sm_client.get_secret_value(SecretId=secret_name)424 assert create_date == res["CreatedDate"]425 res = sm_client.describe_secret(SecretId=secret_name)426 assert "LastChangedDate" in res427 assert create_date == res["LastChangedDate"]...
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!!