Questions tagged [moto]

Moto is a Python library that allows you to easily mock out tests based on AWS infrastructure and the Boto library (an AWS SDK for python).

Moto is a Python library that allows you to easily mock out tests based on AWS infrastructure and the Boto library (an AWS SDK for python).

Related tags:

Links:

193 questions
0
votes
0 answers

How can I add permissions to write an AWS Glue dynamic frame when performing unit test with pytest and moto?

I've been working on this for a while, I'm still new to unit tests, so there's a good chance I'm missing something fundamental in my code. The problem is that in my unit test, when I call my function which uses AWS glue…
0
votes
0 answers

How to test wrong AWS credentials with moto

I try to write tests for my AWS libraries and I use moto for it. For example, for s3 service I use @mock_s3() decarator above the test and it works. My libraries require AWS profile name as an argument in init method. So in tests Whenever I provide…
Maxim1110
  • 1
  • 1
0
votes
1 answer

Is there any error with local moto server and cognito-idp in boto3 with awssrp?

I have a local moto server and am verifying cognito-idp in boto3 with awssrp, but I get an error. The error message is. Traceback (most recent call last): File "/tests/get_token.py", line 71, in token_res =…
0
votes
2 answers

How to mock Athena query results values with Moto3 for a specific table?

I am using pytest and moto3 to test some code similar to this: response = athena_client.start_query_execution( QueryString='SELECT * FROM xyz', QueryExecutionContext={'Database': myDb}, ResultConfiguration={'OutputLocation':…
Randomize
  • 8,651
  • 18
  • 78
  • 133
0
votes
1 answer

My function uses my real dynamodb table instead of the moto mocked one

I have a function which get item from a dynamodb table, add 1, put it back in the table and then return the value import json import boto3 dynamodb = boto3.resource('dynamodb', 'us-east-1') table = dynamodb.Table('cloud-resume-challenge') def…
brztr
  • 3
  • 3
0
votes
1 answer

How to know mock postgres host name?

I´m trying to create some unit tests on a python aws lambda proyect using moto. I´ve created an rds postgres instance using: @pytest.fixture(scope='function') def rds(aws_credentials): with mock_rds(): yield boto3.client("rds",…
juanmorschrott
  • 573
  • 5
  • 25
0
votes
1 answer

How to simulate AWS services and env locally using Python moto?

Is it practically possible to simulate AWS environment locally using Moto and Python? I want to write a aws gluejob that will fetch record from my local database and will upload to S3 bucket for data quality check and later trigger a lambda function…
0
votes
0 answers

Mock AWS Lambda with moto

I have a lambda in Python that I want to mock using the moto framework. When I use the mock_lambda() context manager (ie: with mock_lambda(): #do stuff), I'm still getting an error like "error running docker: Error while fetching server API version:…
0
votes
1 answer

How to mock test ec2 describe_reserved_instance

The describe_reserved_instance function of mock_ec2 has not been implemented in moto lib. In this case, how can one write a unites for the following function in python? def get_reserved_instance(ec2_client): ri_response =…
Jason LiLy
  • 634
  • 2
  • 9
  • 19
0
votes
0 answers

Mocking cross account event bridge target rules

Trying to use moto library to mock AWS services. I have been successful trying to put a SQS queue as target to event bridge in the same account Account1. Not sure if moto supports cross account event bridge test cases, however, when I try to put…
ZZzzZZzz
  • 1,800
  • 3
  • 29
  • 51
0
votes
1 answer

Cannot pytest AWS SES using mock_ses from moto

I am struggling to write mock test for AWS SES. Below is the content of aws_ses.py the file that I want to test- def invoke_ses(send_args,ses_client): try: response = ses_client.send_templated_email(**send_args) except ClientError as…
Vinit Kumar
  • 55
  • 10
0
votes
0 answers

Moto to launch aws glue jobs

I would like to test a glue job with Moto ( https://docs.getmoto.org/en/latest/docs/services/glue.html ). So I first start by creating the glue job: @mock_glue @mock_s3 class…
LizardKing
  • 601
  • 6
  • 13
0
votes
0 answers

How to mock sqs, but use live ssm parameters in python

I'm running some unit tests and mocking sqs from moto import mock_sqs @pytest.fixture def moto_boto(): @mock_sqs def boto_resources(): # setup mocked SQS for output sqs_resource = boto3.resource('sqs', region_name=REGION) …
Yirmi
  • 332
  • 2
  • 13
0
votes
1 answer

Python Moto Mock Ec2 Filter

Hi I have a following class/ function class A: def __init__(aws_profile_name, aws_region, ec2_id): self.session = boto3.session.Session(profile_name=aws_profile_name, aws_region) self.ec2 = EC2(self.session, aws_region,…
spiderloop
  • 809
  • 1
  • 9
  • 10
0
votes
0 answers

"delete_message" not working on sqs client under moto

I have a code like: class SqsClientWrapper: def __init__(self, sqs_client, queue_url): self.sqs_client = sqs_client self.queue_url = queue_url def receive_message(self): try: while True: response =…
de1337ed
  • 3,113
  • 12
  • 37
  • 55