Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python-test-samples/lambda-mock/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ clean: ##=> Deletes current build environment and latest build
rm -rf ./.aws-sam/ ./venv/

checkOSDependencies:
python3 --version || grep "3.9" || (echo "Error: Requires Python 3.9" && exit 1)
python3 --version | grep "3.13" || (echo "Error: Requires Python 3.13" && exit 1)

all: clean build

Expand Down
7 changes: 4 additions & 3 deletions python-test-samples/lambda-mock/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![python: 3.9](https://img.shields.io/badge/Python-3.9-green)](https://img.shields.io/badge/Python-3.9-green)
[![python: 3.13](https://img.shields.io/badge/Python-3.13-green)](https://img.shields.io/badge/Python-3.13-green)
[![AWS: DynamoDB](https://img.shields.io/badge/AWS-DynamoDB-blueviolet)](https://img.shields.io/badge/AWS-DynamoDB-blueviolet)
[![AWS: S#](https://img.shields.io/badge/AWS-S3-green)](https://img.shields.io/badge/AWS-AWS-S3-green)
[![test: unit](https://img.shields.io/badge/Test-Unit-blue)](https://img.shields.io/badge/Test-Unit-blue)
Expand Down Expand Up @@ -70,14 +70,14 @@ This pattern can be used with a variety of infrastructure as code systems includ

The code in this project is simplified - we’ve opted for concise snippets over fully completed or PEP8 compliant production code.

[Top](#contents)
[Top](#contents)x

---
## Prerequisites

* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
* [AWS Serverless Application Model (SAM) CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
* [Python 3.9](https://www.python.org/downloads/)
* [Python 3.13](https://www.python.org/downloads/)
* [Make build utility](https://www.gnu.org/software/make/)

[Top](#contents)
Expand All @@ -100,6 +100,7 @@ The project Makefile contains helper commands for working with the project:

## Running the project

* Setting default region: export AWS_DEFAULT_REGION=us-east-1
* First, create the Python Virtual Environment by using the ```make install``` command.
* Run the unit tests with the ```make test``` command.
* To (optionally) deploy the project, use the ```make deploy.g``` command.
Expand Down
2 changes: 1 addition & 1 deletion python-test-samples/lambda-mock/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Resources:
Properties:
CodeUri: ./src/sample_lambda/
Handler: app.lambda_handler
Runtime: python3.9
Runtime: python3.13
MemorySize: 256
Architectures:
- arm64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from unittest import TestCase
from unittest.mock import MagicMock, patch
from boto3 import resource, client
import moto
from moto import mock_aws # Changed from import moto
from aws_lambda_powertools.utilities.validation import validate

# [0] Import the Globals, Classes, Schemas, and Functions from the Lambda Handler
Expand All @@ -21,8 +21,7 @@
from src.sample_lambda.schemas import INPUT_SCHEMA # pylint: disable=wrong-import-position

# [1] Mock all AWS Services in use
@moto.mock_dynamodb
@moto.mock_s3
@mock_aws # Changed from @moto.mock_dynamodb @moto.mock_s3
class TestSampleLambda(TestCase):
"""
Test class for the application sample AWS Lambda Function
Expand Down Expand Up @@ -198,4 +197,4 @@ def tearDown(self) -> None:
dynamodb_resource = client("dynamodb", region_name="us-east-1")
dynamodb_resource.delete_table(TableName = self.test_ddb_table_name )

# End of unit test code
# End of unit test code