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

NotImplementedError: ElasticNetworkInterfaces(AmazonVPC).describe_network_interface_attribute is not yet implemented

How describe a network interface attribute for a mock_ec2 in test_elastic_network_interfaces_get_by_description function? @mock_ec2 def test_elastic_network_interfaces_get_by_description(): ec2 = boto3.resource("ec2", region_name="us-east-1") …
Guillermo
  • 61
  • 1
  • 8
0
votes
0 answers

Boto3 dynamodb Unit test error using moto - Error " An error occurred (ResourceNotFoundException) when calling the Scan operation"

I'm trying to test my helper methods that are wrappers around the existing boto3 dynamodb calls. When I try to test my helper method, I get the following error botocore.errorfactory.ResourceNotFoundException: An error occurred…
user2993021
  • 87
  • 1
  • 8
0
votes
1 answer

Mocking integrated AWS s3 function with moto and fastapi

I'm trying to mock some AWS functionalities that are integrated in a post request function. Initially I tried with python mock lib. However, the calls are still made to AWS such as the two way authentication. The mock lib code looks like this. Test…
Casper
  • 1
  • 5
0
votes
1 answer

Add parameters to AWS EC2 run_instances call under test

During the unit test the application code calls run_instances (a method of the boto3 EC2.Client). How to intercept these calls and add TagSpecifications parameters to them? I'm using moto for the test assertions (maybe it can set up some hooks to…
Velkan
  • 7,067
  • 6
  • 43
  • 87
0
votes
1 answer

Failing basic AWS Glacier mocking using moto

I am trying to mock simple Glacier calls (creation and deletion of a Glacier vault) and can't find my way around this (despite being able to achieve such simple mocking with S3, creating a Bucket). It seems that the mocking of Glacier simply isn't…
EnzoMolion
  • 949
  • 8
  • 25
0
votes
1 answer

Unit test failed with moto in azure pipeline

I made a wrapper for aws cloudwatch in python with boto3. And I am doing the unit test with moto, everything go smoothly in my local PC. After I pushed my code to Azure Repo to trigger the pipeline, I always get the error message. I want to know how…
EnergyBoy
  • 547
  • 1
  • 5
  • 18
0
votes
0 answers

moto testing for ecs

I have a python method that lists certain ECS Fargate services based on some tags and some names using boto3 get_paginator. def list_service_name(environment, resource_owner_name, ecs_client): …
change198
  • 1,647
  • 3
  • 21
  • 60
0
votes
1 answer

How to push a docker image to ecr repo in moto server

I am running moto server using the command moto_server ecr -p 5000 -H 0.0.0.0 I created an ECR repo using the moto server with the command, aws ecr create-repository --repository-name test --endpoint-url http://localhost:5000 --region…
Malathi
  • 2,119
  • 15
  • 40
0
votes
1 answer

Using unittests and moto to mock AWS

I am used to pytest approach for unit testing, without using classes. Today I wanted to give a try to unittest and I wanted to encapsulate my tests inside a TestCase. Then consider this sample test class: import unittest import moto import…
Navarro
  • 1,284
  • 2
  • 17
  • 40
0
votes
1 answer

How to verify a JWT token generated with moto mock cognitoidp

i am trying to test my server side handling of cognito JWT tokens in a python application. i am using Moto to create a cognito user pool, create a user in the pool, authenticate the user, and get back a JWT. that all works fine, until i want to…
0
votes
1 answer

S3 unit tests boto client

Having issues writing a unit test for S3 client, it seems the test is trying to use a real s3 client rather than the one i have created for the test here is my example @pytest.fixture(autouse=True) def moto_boto(self): # setup: start…
AnonymousAlias
  • 1,149
  • 2
  • 27
  • 68
0
votes
1 answer

Force an exception to be handled

I would like an exception to be thrown so I can complete coverage for a few lines. def __query_items_from_db(self, my_id: str) -> list: result = None try: result = self.table.query( …
0
votes
0 answers

How to write unittest code for flask REST API using moto and pytest?

We are developing a Flask REST API using dynamoDB as a database. I want to write the unit test code for the same application. I am using moto to mock the dynamoDB. here is the code of conftest.py import os import boto3 import pytest from moto…
bSr
  • 1,410
  • 3
  • 16
  • 30
0
votes
0 answers

How to get mock events in Boto3

I have an s3 bucket that has an SNS registered to it. The SNS notification goes onto an SQS which is monitored by a lambda that I'd like to test. I'm using moto to mock my s3 calls in my test. When I set up my test, I put an object into my S3…
Steve
  • 4,457
  • 12
  • 48
  • 89
0
votes
0 answers

Moto mock s3 seems to run but can't find files

I'm trying to mock an s3 instance with Moto, which does seem to work, however for some reason it seems to search the real s3 for files instead of the mocked s3. My working hierarchy looks something like this: root --tests ----mock…
Oliver Robie
  • 818
  • 2
  • 11
  • 30
1 2 3
12
13