Best Python code snippet using localstack_python
test_sts.py
Source:test_sts.py  
...146        assert response["Credentials"]["Expiration"]147        federated_user_info = response["FederatedUser"]["FederatedUserId"].split(":")148        assert federated_user_info[1] == token_name149    @pytest.mark.only_localstack150    def test_get_caller_identity_root(self, sts_client, iam_client, monkeypatch):151        response = sts_client.get_caller_identity()152        account_id = response["Account"]153        assert f"arn:aws:iam::{account_id}:root" == response["Arn"]154    @pytest.mark.only_localstack155    def test_expiration_date_format(self):156        url = config.get_edge_url()157        data = {"Action": "GetSessionToken", "Version": "2011-06-15"}158        headers = aws_stack.mock_aws_request_headers("sts")159        headers["Accept"] = APPLICATION_JSON160        response = requests.post(url, data=data, headers=headers)161        assert response162        content = json.loads(to_str(response.content))163        # Expiration field should be numeric (tested against AWS)164        result = content["GetSessionTokenResponse"]["GetSessionTokenResult"]...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!!
