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
3
votes
2 answers

How can I mock ssm from boto3?

I tried moto, but I always get: botocore.exceptions.ClientError: An error occurred (UnrecognizedClientException) when calling the GetParameter operation: The security token included in the request is invalid. MVCE: test_example.py import…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
3
votes
1 answer

How to mock AWS calls when using Boto3 (version 1.8 or higher) with Moto

I have an API written in python that makes calls to AWS services, specifically sqs, s3, and dynamodb. I am trying to write unit tests for the API and I want to mock all calls to AWS. I have done a lot of research into moto as a way to mock these…
Jackie
  • 131
  • 1
  • 10
3
votes
2 answers

How to create ami with specific image-id using moto?

I'am using moto to mock aws for my application. I wondering if it is possible to create ami in moto with specific image-id (for example: ami-1a2b3c4d). Thank you!
emedentsii
  • 653
  • 1
  • 5
  • 9
3
votes
1 answer

How to connect to moto standalone server?

I just installed moto and tried to connect to the standalone server with the following node.js code: const AWS = require('aws-sdk') const ep = new AWS.Endpoint('http://127.0.0.1:5000') const route53 = new AWS.Route53({endpoint: ep}) const params =…
Brian
  • 12,145
  • 20
  • 90
  • 153
3
votes
1 answer

How to unit test aws athena sql queries in python lambda?

I have a python lambda that will call an SQL query to Athena for pulling certain data for my lambda calculation. How do I unit test Athena queries in the lambda? As lambda uses some other services I used MOTO to mock services.
pyhotshot
  • 445
  • 8
  • 23
3
votes
1 answer

Error opening /sys/class/power_supply/bms/resistance

When i launch app then below error print in debug log, i want to find out is it app side issue or device side, i am new in android development so can anyone confirm this why below log is came ? Device Moto G3 12-28 11:09:31.190 6380-6403/?…
Yogesh Rathi
  • 6,331
  • 4
  • 51
  • 81
2
votes
2 answers

How to access my own fake bucket with S3FileSystem, Pytest and Moto

I'm trying to implement Unit Tests using Pytest, Moto (4.1.6) and s3fs (0.4.2) for my functions that interact with S3. So far I am able to create a bucket and populate it with all the files that live in the data folder. Unfortunately one of my…
A Campos
  • 753
  • 3
  • 10
  • 31
2
votes
1 answer

How to mock an AWS Lambda with moto

I created a code to invoke a AWS lambda function created somewhere else. I would like to use moto for testing it, but I don't really understand how to do it and I continue to obtain errors. This is a simple example of the main code: import…
cicciodevoto
  • 305
  • 4
  • 19
2
votes
1 answer

How to mock a stepfunction

I have a AWS Lambda function where I am starting the execution of the step function. Now I want to write a test case for the same using Pytest. I am not sure how to mock a stepfunction using Moto. Following is the code snippet of my stepfunction in…
user18148705
  • 215
  • 1
  • 11
2
votes
1 answer

mock secret manager using pytest

I am trying to mock secret manager. Here is the code which is written for secret manager using boto3 which I am trying to mock and test. utils.py import boto3 secret_id = os.environ.get("SECRETS") client = boto3.client('secretsmanager') response =…
Lovika
  • 577
  • 2
  • 10
  • 21
2
votes
2 answers

How to mock multiple dynamodb tables using moto

I have a function create which uses 3 dynamodb tables. How do i mock three Dynamo db tables? def create(): //This function uses a dynamodb table "x" // Then it calls my_table() function def my_table(): // This function basically uses…
geek
  • 89
  • 2
  • 10
2
votes
0 answers

Test S3 operations with simulated credentials

I'm writing unit tests for a function that should authenticate to AWS S3 and then perform some operations on S3. I have a bunch of functions that do various things (like downloading/uploading files, checking for existence, etc). Since in production…
cyau
  • 449
  • 4
  • 14
2
votes
1 answer

Python mock AWS SSM

I have written a code that will fetch SSM parameters for me import boto3 client = boto3.client('ssm') def lambda_handler(event, context): return client.get_parameter(Name=event["param"], WithDecryption=True) if __name__ ==…
Abhishek Patil
  • 1,373
  • 3
  • 30
  • 62
2
votes
1 answer

Mock download file from s3 with actual file

I would like to write a test to mock the download of a function from s3 and replace it locally with an actual file that exists of my machine. I took inspiration from this post. The idea is the following: from moto import mock_s3 import boto3 def…
Bubble
  • 63
  • 1
  • 9
2
votes
0 answers

How to fix botocore.exceptions.ClientError: An error occurred (404) when calling the Invoke operation

I am trying to mock a lambda invocation using pytest and moto. Below is my working code. import zipfile import os import boto3 from moto import mock_lambda,mock_iam import pytest import io from botocore.exceptions import ClientError import…
Naxi
  • 1,504
  • 5
  • 33
  • 72
1 2
3
12 13