Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests and Python Upgrade #4

Merged
merged 3 commits into from
Jan 17, 2024
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
15 changes: 7 additions & 8 deletions .github/workflows/stage-cf-deploy-lambda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
name: Stage CF Lambda@Edge Full Deploy

on:
workflow_dispatch:
## We are skipping automation for now
# push:
# branches:
# - main
# paths-ignore:
# - ".github/**"
# - "tests/**"
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- ".github/**"
- "tests/**"

defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9
3.11.4
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ safety: # check for security vulnerabilities and verify Pipfile.lock is up-to-da
pipenv check
pipenv verify

lint-apply: # apply changes with 'black' and resolve 'fixable errors' with 'ruff'
black-apply
lint-apply: black-apply # apply changes with 'black'

black-apply: # apply changes with 'black'
pipenv run black .
Expand Down
5 changes: 1 addition & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
sentry-sdk = "*"

[dev-packages]
black = "*"
coveralls = "*"
pre-commit = "*"
pytest = "*"

[requires]
python_version = "3.9"
python_version = "3.11"
57 changes: 4 additions & 53 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions tests/fixtures/origin-event-cdn-dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"Records": [
{
"cf": {
"config": {
"distributionDomainName": "d111111abcdef8.cloudfront.net",
"distributionId": "EDFDVBD6EXAMPLE",
"eventType": "origin-request",
"requestId": "4TyzHTaYWb1GX1qTfsHhEqV6HUDd_BzoBZnwfnvQc_1oF26ClkoUSEQ=="
},
"request": {
"clientIp": "1.2.3.4",
"headers": {
"host": [
{
"key": "Host",
"value": "cdn.dev1.mitlibrary.net"
}
],
"x-forwarded-for": [
{
"key": "X-Forwarded-For",
"value": "1.2.3.4"
}
],
"user-agent": [
{
"key": "User-Agent",
"value": "Amazon CloudFront"
}
],
"via": [
{
"key": "Via",
"value": "2.0 783f879853c2b9ca9ca52e32a3b62dd8.cloudfront.net (CloudFront)"
}
],
"accept-encoding": [
{
"key": "Accept-Encoding",
"value": "gzip"
}
]
},
"method": "GET",
"origin": {
"s3": {
"authMethod": "origin-access-identity",
"customHeaders": {},
"domainName": "cdn.dev1.mitlibrary.net.s3.amazonaws.com",
"path": "",
"region": "us-east-1"
}
},
"querystring": "",
"uri": "/index.html"
}
}
}
]
}
61 changes: 61 additions & 0 deletions tests/fixtures/origin-event-cdn-prod-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"Records": [
{
"cf": {
"config": {
"distributionDomainName": "d111111abcdef8.cloudfront.net",
"distributionId": "EDFDVBD6EXAMPLE",
"eventType": "origin-request",
"requestId": "4TyzHTaYWb1GX1qTfsHhEqV6HUDd_BzoBZnwfnvQc_1oF26ClkoUSEQ=="
},
"request": {
"clientIp": "1.2.3.4",
"headers": {
"host": [
{
"key": "Host",
"value": "cdn.mitlibrary.net"
}
],
"x-forwarded-for": [
{
"key": "X-Forwarded-For",
"value": "1.2.3.4"
}
],
"user-agent": [
{
"key": "User-Agent",
"value": "Amazon CloudFront"
}
],
"via": [
{
"key": "Via",
"value": "2.0 336a36b0f05a8791fdf32df30f71a8f4.cloudfront.net (CloudFront)"
}
],
"accept-encoding": [
{
"key": "Accept-Encoding",
"value": "gzip"
}
]
},
"method": "GET",
"origin": {
"s3": {
"authMethod": "origin-access-identity",
"customHeaders": {},
"domainName": "cdn.mitlibrary.net.s3.amazonaws.com",
"path": "",
"region": "us-east-1"
}
},
"querystring": "",
"uri": "/index.html"
}
}
}
]
}
61 changes: 61 additions & 0 deletions tests/fixtures/origin-event-cdn-prod-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"Records": [
{
"cf": {
"config": {
"distributionDomainName": "d111111abcdef8.cloudfront.net",
"distributionId": "EDFDVBD6EXAMPLE",
"eventType": "origin-request",
"requestId": "4TyzHTaYWb1GX1qTfsHhEqV6HUDd_BzoBZnwfnvQc_1oF26ClkoUSEQ=="
},
"request": {
"clientIp": "1.2.3.4",
"headers": {
"host": [
{
"key": "Host",
"value": "cdn.libraries.mit.edu"
}
],
"x-forwarded-for": [
{
"key": "X-Forwarded-For",
"value": "1.2.3.4"
}
],
"user-agent": [
{
"key": "User-Agent",
"value": "Amazon CloudFront"
}
],
"via": [
{
"key": "Via",
"value": "2.0 336a36b0f05a8791fdf32df30f71a8f4.cloudfront.net (CloudFront)"
}
],
"accept-encoding": [
{
"key": "Accept-Encoding",
"value": "gzip"
}
]
},
"method": "GET",
"origin": {
"s3": {
"authMethod": "origin-access-identity",
"customHeaders": {},
"domainName": "cdn.mitlibrary.net.s3.amazonaws.com",
"path": "",
"region": "us-east-1"
}
},
"querystring": "",
"uri": "/index.html"
}
}
}
]
}
61 changes: 61 additions & 0 deletions tests/fixtures/origin-event-cdn-stage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"Records": [
{
"cf": {
"config": {
"distributionDomainName": "d111111abcdef8.cloudfront.net",
"distributionId": "EDFDVBD6EXAMPLE",
"eventType": "origin-request",
"requestId": "4TyzHTaYWb1GX1qTfsHhEqV6HUDd_BzoBZnwfnvQc_1oF26ClkoUSEQ=="
},
"request": {
"clientIp": "1.2.3.4",
"headers": {
"host": [
{
"key": "Host",
"value": "cdn.stage.mitlibrary.net"
}
],
"x-forwarded-for": [
{
"key": "X-Forwarded-For",
"value": "1.2.3.4"
}
],
"user-agent": [
{
"key": "User-Agent",
"value": "Amazon CloudFront"
}
],
"via": [
{
"key": "Via",
"value": "2.0 336a36b0f05a8791fdf32df30f71a8f4.cloudfront.net (CloudFront)"
}
],
"accept-encoding": [
{
"key": "Accept-Encoding",
"value": "gzip"
}
]
},
"method": "GET",
"origin": {
"s3": {
"authMethod": "origin-access-identity",
"customHeaders": {},
"domainName": "cdn.stage.mitlibrary.net.s3.amazonaws.com",
"path": "",
"region": "us-east-1"
}
},
"querystring": "",
"uri": "/index.html"
}
}
}
]
}
Loading
Loading