Skip to main content

A small Python library that includes details mocks of AWS Lambda event sources.

Project description

Event Mocks Python

A small Python library that includes detail mocks of Serverless function events. Useful when unit testing your Serverless functions.

Supported Providers and Event Types:

  • AWS: aws
    • API Gateway: api-gateway

This library simply uses default event source mock templates and merges them with any overwrite you provide. Check out the JSON template files to learn more about the data structure of each event source.


Quick Start

Install Event Mocks Python using:

pip install git+ssh://git@github.com:Abir-H/serverless-event-mocks.git

Import and use the create_event function into any Python code using

from serverless_event_mocks.event import create_event

provider = 'aws'
event_type = 'api_gateway'
event_payload = {
    "body" : {
        "first_name": "Sam",
        "last_name": "Smith"
    }
}

event = create_event(provider, event_type, event_payload)

Run Tests and Linter

# Run unit tests
make test

# Run Flake8 linter
make lint

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

serverless-event-mocks-0.0.1.tar.gz (2.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page