Skip to content

Instantly share code, notes, and snippets.

@UtsavChokshiCNU
Created November 18, 2020 08:37
Show Gist options
  • Save UtsavChokshiCNU/974d89caefac9de9e602bbaf4260c420 to your computer and use it in GitHub Desktop.
Save UtsavChokshiCNU/974d89caefac9de9e602bbaf4260c420 to your computer and use it in GitHub Desktop.
Moto Example
# pip install moto boto3
import boto3
from moto import mock_iam
@mock_iam
def test_create_user():
iam_client = boto3.client('iam', region_name='us-east-1')
library_name = 'xyz'
response1 = iam_client.create_user(
UserName=library_name,
Tags=[{
'Key': 'project',
'Value': 'devflows'
},
{
'Key': 'type',
'Value': 'library'
}]
)
response2 = iam_client.get_user(UserName=library_name)
assert response1['User']['UserId'], response2['User']['UserId']
test_create_user()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment