Skip to content
Merged
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,8 @@ venv.bak/
/site

# mypy
.mypy_cache/
.mypy_cache/

# deployment package
package.zip
package/
8 changes: 8 additions & 0 deletions cdn_lambda/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from cdn_lambda.functions.map_to_s3.map_to_s3 import (
lambda_handler as origin_request,
)

# All lambda functions should be exported from this module.
# Name them after the trigger with which they're intended to be used.

__all__ = ["origin_request"]
7 changes: 7 additions & 0 deletions tests/test_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from cdn_lambda import origin_request


def test_have_origin_request():
"""cdn_lambda should export a function named origin_request"""

assert callable(origin_request)
21 changes: 21 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@ deps=
commands=pytest {posargs}
whitelist_externals=sh

# Create a lambda deployment package.
[testenv:package]
skip_install=true
deps=
whitelist_externals=
sh
rm
cp
commands=
rm -rf ./package

# --no-deps to avoid using anything untrusted from PyPI;
# currently all deps are expected to be available from lambda runtime anyway.
pip install --no-deps --target ./package .

# Always using hardcoded config for now.
cp cdn_lambda/functions/map_to_s3/map_to_s3.json package

sh -c 'cd package && zip -r ../package.zip .'
rm -rf ./package

[testenv:static]
deps=
-rtest-requirements.txt
Expand Down