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
1
vote
1 answer

Real time linear interpolation about 3-D servo motor

As we know in ordinary linear interpolation, the final destination is fixed. I want to use a camera to catch the moving objects and the coordinate can be the final destination. Anybody could help me finish this algorithm in C code?
Rafael
  • 141
  • 1
  • 1
  • 5
0
votes
1 answer

How to mock correctly a class' aws client with moto?

So I'm doing tests for my lambdas using pytest and moto, the issue is that every lambda has parameters stored in Parameter Store (some also in Secrets Manager) but for the sake of caching I use a class that compiles all params: # Initializing…
Alyx
  • 9
  • 1
0
votes
1 answer

How to get verification code/change password code in boto3?

I'm writing tests in Moto and Pytest for a confirm sign up route that receives a verification code and a email and uses boto method confirm_sign_up to confirm user. My question is: After I created a user pool, a client and a user, how can I get the…
0
votes
0 answers

moto metadata path has not been implemented

Locally I can run Moto just fine. When I run moto unit tests from Jenkins, I get the following error: NotImplementedError: The /latest/dynamic/instance-identity/pkcs7 metadata path has not been implemented I am trying to run tests which mock…
dataviews
  • 2,466
  • 7
  • 31
  • 64
0
votes
1 answer

Deploying SAM template to Moto server?

Is there a way where we can deploy a SAM template to moto server? We can create resources using the AWS cli and using the --endpoint-url e.g., aws iam create-role --endpoint-url=http://127.0.0.1:5000 --role-name lambda-exec-role…
AbNig
  • 391
  • 1
  • 6
  • 24
0
votes
2 answers

What is the proper way to use mock_secretsmanager in a module scoped pytest fixture?

This does not work @pytest.fixture(scope="module") def monkeypatch_module(): # gross bug: https://github.com/pytest-dev/pytest/issues/363 from _pytest.monkeypatch import MonkeyPatch mpatch = MonkeyPatch() yield mpatch …
red888
  • 27,709
  • 55
  • 204
  • 392
0
votes
1 answer

Unable to mock dynamoDB in pytest fixture

I'm trying to create a dynamoDB in a pytest fixture and use it in other tests to reduce code redundancy, but having some issues. @pytest.fixture @mock_dynamodb def create_test_table(self, mocker): table_name = "table" dynamodb =…
SafeDev
  • 641
  • 4
  • 12
0
votes
1 answer

How can I achieve test coverage for `ClientError` exceptions raised in my unit tests for a Python script that utilizes boto3 and moto?

I have this python script snippet with mocked aws infrastructure for a todo list application: import os import boto3 import time import uuid import json import functools from botocore.exceptions import ClientError def get_table(dynamodb=None): …
javier
  • 1
0
votes
0 answers

Aws Moto redshift statements description assertions (Python)

Considering an AWS lambda written in Python that uses boto3 as client to AWS Redshift service. Considering the following example: import boto3 import moto def lambda_handler(event, context): session = boto3.session.Session() …
Yak O'Poe
  • 760
  • 4
  • 14
0
votes
0 answers

Managing AWS regions with Moto

Context We have code which gets IPs from many AWS accounts within our organisation. Running this code returns IPs from each enabled region but throws exceptions for each disabled region. We have wrapped the code in a guard clause, ensuring we only…
Joe
  • 678
  • 9
  • 24
0
votes
0 answers

Passing mock boto3 client in init.py

I am trying to figure out how to pass a mock boto3 client to init.py with pytest, but am having some trouble. When I pass my fixture into the function I'm trying to test, the function called in init.py still tries to use a real instance of the boto…
0
votes
0 answers

Mocking S3 And Lambda in Python

I have a series of AWS resources that I use to convert pdf files and read tables off them. There is a lambda that reads off an SNS topic message, which has a list of objects, each with a key (filename) and location (s3 address). The lambda then…
clattenburg cake
  • 1,096
  • 3
  • 19
  • 40
0
votes
0 answers

@mock_dynamodb2 saves table context

Im mocking dynamo db client using @mock_dynamodb2 provided by moto. In my tests Im creating tables and test some input - straight forward. When I run the code to create the table more than once (even when turning off the computer) I see that the…
0
votes
1 answer

Aws Moto redshift statements assertions (Python)

Considering an AWS lambda written in Python that uses boto3 as client to AWS Redshift service. Considering the following example: import boto3 import moto def lambda_handler(event, context): session = boto3.session.Session() …
Yak O'Poe
  • 760
  • 4
  • 14
0
votes
1 answer

Aws lambda unit test throwing SegmentNotFoundException

I'm trying to write unit tests for an AWS Lambda function that uses the boto3 library to interact with AWS S3. I'm using the moto library to mock S3 in my tests. However, I'm running into an error that says raise…