Sahil
Sahil

Reputation: 116

Unit Testing AWS Lambda function for DynamoDB using moto 5.x.x

In the latest moto version @mock_dynamodb and @mock_dynamodb2 are depricated and removed. Can someone please share an example of mocking and unit testing dynamodb operation from AWS Lambda using moto. Found a few examples using @mock_aws, but nothing concrete.

Upvotes: 3

Views: 1454

Answers (1)

Bert Blommers
Bert Blommers

Reputation: 2123

The behaviour is mostly the same between v4 and v5 - you just have to replace mock_dynamodb with mock_aws.

There are a ton of unit tests in the Moto project that you can use as examples though: https://github.com/getmoto/moto/blob/master/tests/test_dynamodb/test_dynamodb.py

Upvotes: 3

Related Questions