Best Python code snippet using localstack_python
test_secrets_manager.py
Source: test_secrets_manager.py
...31 'SecretId': 'airflow/connections/test_postgres',32 'SecretString': 'postgresql://airflow:airflow@host:5432/airflow'33 }34 secrets_manager_backend = SecretsManagerBackend()35 secrets_manager_backend.client.put_secret_value(**param)36 returned_uri = secrets_manager_backend.get_conn_uri(conn_id="test_postgres")37 self.assertEqual('postgresql://airflow:airflow@host:5432/airflow', returned_uri)38 @mock_secretsmanager39 def test_get_conn_uri_non_existent_key(self):40 """41 Test that if the key with connection ID is not present,42 SecretsManagerBackend.get_connections should return None43 """44 conn_id = "test_mysql"45 param = {46 'SecretId': 'airflow/connections/test_postgres',47 'SecretString': 'postgresql://airflow:airflow@host:5432/airflow'48 }49 secrets_manager_backend = SecretsManagerBackend()50 secrets_manager_backend.client.put_secret_value(**param)51 self.assertIsNone(secrets_manager_backend.get_conn_uri(conn_id=conn_id))52 self.assertEqual([], secrets_manager_backend.get_connections(conn_id=conn_id))53 @mock_secretsmanager54 def test_get_variable(self):55 param = {56 'SecretId': 'airflow/variables/hello',57 'SecretString': 'world'58 }59 secrets_manager_backend = SecretsManagerBackend()60 secrets_manager_backend.client.put_secret_value(**param)61 returned_uri = secrets_manager_backend.get_variable('hello')62 self.assertEqual('world', returned_uri)63 @mock_secretsmanager64 def test_get_variable_non_existent_key(self):65 """66 Test that if Variable key is not present,67 SystemsManagerParameterStoreBackend.get_variables should return None68 """69 param = {70 'SecretId': 'airflow/variables/hello',71 'SecretString': 'world'72 }73 secrets_manager_backend = SecretsManagerBackend()74 secrets_manager_backend.client.put_secret_value(**param)...
test_secretsmanager.py
Source: test_secretsmanager.py
...9 secret_id = "get_secret_value"10 secret_data = {"secret": "data"}11 with pytest.raises(secretsmanager.AwsNotFoundException):12 secret = secretsmanager.get_secret_value(secret_id)13 secretsmanager.put_secret_value(secret_id, secret_data)14 secret = secretsmanager.get_secret_value(secret_id)15 assert secret["secret"] == "data"16 with patch("kolvir.aws.secretsmanager.get_client") as client:17 client.return_value.exceptions.ResourceNotFoundException = StubException18 client.return_value.get_secret_value.side_effect = ClientError(19 {"Error": {"Code": 429}}, "test"20 )21 with pytest.raises(secretsmanager.AwsException):22 secretsmanager.get_secret_value(secret_id)23 secretsmanager.put_secret_value(secret_id, "data")24 assert secretsmanager.get_secret_value(secret_id) == "data"25def test_put_secret_value():26 secret_id = "put_secret_value"27 secret_data = {"secret": "data"}28 with pytest.raises(secretsmanager.AwsNotFoundException):29 secret = secretsmanager.get_secret_value(secret_id)30 secretsmanager.put_secret_value(secret_id, secret_data)31 secret = secretsmanager.get_secret_value(secret_id)32 assert secret["secret"] == "data"33 with patch("kolvir.aws.secretsmanager.get_client") as client:34 client.return_value.exceptions.ResourceNotFoundException = StubException35 client.return_value.put_secret_value.side_effect = ClientError(36 {"Error": {"Code": 429}}, "test"37 )38 with pytest.raises(secretsmanager.AwsException):39 secretsmanager.put_secret_value(secret_id, secret_data)40 secretsmanager.put_secret_value(secret_id, "data")41 assert secretsmanager.get_secret_value(secret_id) == "data"42def test_create_secret():43 secret_id = "create_secret"44 secret_data = {"secret": "data"}45 with pytest.raises(secretsmanager.AwsNotFoundException):46 secretsmanager.get_secret_value(secret_id)47 secretsmanager.create_secret(secret_id, secret_data)48 with pytest.raises(secretsmanager.AwsResourceExistsException):49 secretsmanager.create_secret(secret_id, secret_data)50 with patch("kolvir.aws.secretsmanager.get_client") as client:51 client.return_value.exceptions.ResourceExistsException = StubException52 client.return_value.create_secret.side_effect = ClientError(53 {"Error": {"Code": 429}}, "test"54 )...
Check out the latest blogs from LambdaTest on this topic:
Are members of agile teams different from members of other teams? Both yes and no. Yes, because some of the behaviors we observe in agile teams are more distinct than in non-agile teams. And no, because we are talking about individuals!
Have you ever visited a website that only has plain text and images? Most probably, no. It’s because such websites do not exist now. But there was a time when websites only had plain text and images with almost no styling. For the longest time, websites did not focus on user experience. For instance, this is how eBay’s homepage looked in 1999.
Unit testing is typically software testing within the developer domain. As the QA role expands in DevOps, QAOps, DesignOps, or within an Agile team, QA testers often find themselves creating unit tests. QA testers may create unit tests within the code using a specified unit testing tool, or independently using a variety of methods.
With the rise of Agile, teams have been trying to minimize the gap between the stakeholders and the development team.
Many theoretical descriptions explain the role of the Scrum Master as a vital member of the Scrum team. However, these descriptions do not provide an honest answer to the fundamental question: “What are the day-to-day activities of a Scrum Master?”
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!!