How to use list_instance_profile_tags method in localstack

Best Python code snippet using localstack_python

test_iam.py

Source:test_iam.py Github

copy

Full Screen

...101 user_name = "user-role-{}".format(short_uid())102 iam_client.create_instance_profile(InstanceProfileName=user_name)103 tags_v0 = []104 #105 rs = iam_client.list_instance_profile_tags(InstanceProfileName=user_name)106 assert rs["Tags"] == tags_v0107 tags_v1 = [gen_tag()]108 #109 rs = iam_client.tag_instance_profile(InstanceProfileName=user_name, Tags=tags_v1)110 assert rs["ResponseMetadata"]["HTTPStatusCode"] == 200111 #112 rs = iam_client.list_instance_profile_tags(InstanceProfileName=user_name)113 assert rs["Tags"] == tags_v1114 tags_v2_new = [gen_tag() for _ in range(5)]115 tags_v2 = tags_v1 + tags_v2_new116 rs = iam_client.tag_instance_profile(InstanceProfileName=user_name, Tags=tags_v2)117 assert rs["ResponseMetadata"]["HTTPStatusCode"] == 200118 #119 rs = iam_client.list_instance_profile_tags(InstanceProfileName=user_name)120 assert rs["Tags"] == tags_v2121 rs = iam_client.tag_instance_profile(InstanceProfileName=user_name, Tags=tags_v2)122 assert rs["ResponseMetadata"]["HTTPStatusCode"] == 200123 #124 rs = iam_client.list_instance_profile_tags(InstanceProfileName=user_name)125 assert rs["Tags"] == tags_v2126 tags_v3_new = [gen_tag()]127 tags_v3 = tags_v1 + tags_v3_new128 target_tags_v3 = tags_v2 + tags_v3_new129 rs = iam_client.tag_instance_profile(InstanceProfileName=user_name, Tags=tags_v3)130 assert rs["ResponseMetadata"]["HTTPStatusCode"] == 200131 #132 rs = iam_client.list_instance_profile_tags(InstanceProfileName=user_name)133 assert rs["Tags"] == target_tags_v3134 tags_v4 = tags_v1135 target_tags_v4 = target_tags_v3136 rs = iam_client.tag_instance_profile(InstanceProfileName=user_name, Tags=tags_v4)137 assert rs["ResponseMetadata"]["HTTPStatusCode"] == 200138 #139 rs = iam_client.list_instance_profile_tags(InstanceProfileName=user_name)140 assert rs["Tags"] == target_tags_v4141 tags_u_v1 = [tag["Key"] for tag in tags_v1]142 target_tags_u_v1 = tags_v2_new + tags_v3_new143 iam_client.untag_instance_profile(InstanceProfileName=user_name, TagKeys=tags_u_v1)144 #145 rs = iam_client.list_instance_profile_tags(InstanceProfileName=user_name)146 assert rs["Tags"] == target_tags_u_v1147 tags_u_v2 = [f"key-{long_uid()}"]148 target_tags_u_v2 = target_tags_u_v1149 iam_client.untag_instance_profile(InstanceProfileName=user_name, TagKeys=tags_u_v2)150 #151 rs = iam_client.list_instance_profile_tags(InstanceProfileName=user_name)152 assert rs["Tags"] == target_tags_u_v2153 tags_u_v3 = [tag["Key"] for tag in target_tags_u_v1]154 target_tags_u_v3 = []155 iam_client.untag_instance_profile(InstanceProfileName=user_name, TagKeys=tags_u_v3)156 #157 rs = iam_client.list_instance_profile_tags(InstanceProfileName=user_name)158 assert rs["Tags"] == target_tags_u_v3159 iam_client.delete_instance_profile(InstanceProfileName=user_name)160 def test_create_user_with_tags(self, iam_client):161 user_name = "user-role-{}".format(short_uid())162 rs = iam_client.create_user(163 UserName=user_name, Tags=[{"Key": "env", "Value": "production"}]164 )165 assert "Tags" in rs["User"]166 assert rs["User"]["Tags"][0]["Key"] == "env"167 rs = iam_client.get_user(UserName=user_name)168 assert "Tags" in rs["User"]169 assert rs["User"]["Tags"][0]["Value"] == "production"170 # clean up171 iam_client.delete_user(UserName=user_name)...

Full Screen

Full Screen

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