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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ jobs:
- run: |
cd services
pip3 install -r requirements.txt
pylint services tests
flake8 services tests
python3 -m unittest
1 change: 1 addition & 0 deletions services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ Make code changes, then deploy them to AWS using the [infrastructure deployment

## Useful Commands

* `flake8` lint code
* `python3 -m unittest` run unit tests
11 changes: 4 additions & 7 deletions services/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
appdirs==1.4.3
astroid==2.5.1
boto3==1.17.26
botocore==1.20.26
CacheControl==0.12.6
Expand All @@ -9,20 +8,20 @@ colorama==0.4.3
contextlib2==0.6.0
distlib==0.3.0
distro==1.4.0
flake8==3.9.0
html5lib==1.0.1
idna==2.8
importlib-metadata==3.7.3
importlib-metadata==3.8.1
ipaddr==2.2.0
isort==5.8.0
jmespath==0.10.0
lazy-object-proxy==1.6.0
lockfile==0.12.2
mccabe==0.6.1
msgpack==0.6.2
packaging==20.3
pep517==0.8.2
progress==1.5
pylint==2.7.2
pycodestyle==2.7.0
pyflakes==2.3.1
pyparsing==2.4.6
python-dateutil==2.8.1
pytoml==0.1.21
Expand All @@ -31,9 +30,7 @@ retrying==1.3.3
s3transfer==0.3.4
six==1.14.0
toml==0.10.2
typed-ast==1.4.2
typing-extensions==3.7.4.3
urllib3==1.25.8
webencodings==0.5.1
wrapt==1.12.1
zipp==3.4.1
1 change: 1 addition & 0 deletions services/services/common/http_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Common HTTP Functionality
"""


def cors_headers():
"""
Return Cross-Origin Resource Sharing (CORS) HTTP Headers.
Expand Down
3 changes: 1 addition & 2 deletions services/services/election/handlers/create.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import json
from services.common.http_support import cors_headers
import boto3


def handler(event, context):
body = {
"message": "POST executed successfully!",
"input": event
}

response = {
"statusCode": 200,
"body": json.dumps(body),
Expand Down
1 change: 1 addition & 0 deletions services/services/election/handlers/delete.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json


def handler(event, context):
body = {
"message": "DELETE executed successfully!",
Expand Down
1 change: 1 addition & 0 deletions services/services/election/handlers/read.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json


def handler(event, context):
body = {
"message": "GET executed successfully!",
Expand Down
1 change: 1 addition & 0 deletions services/services/election/handlers/update.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json


def handler(event, context):
body = {
"message": "PUT executed successfully!",
Expand Down
4 changes: 4 additions & 0 deletions services/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ python_requires = >=3.6

[options.packages.find]
where = services

[flake8]
exclude = .git,__pycache__,build,dist,venv
show_source = True
2 changes: 2 additions & 0 deletions services/tests/election/handlers/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import unittest
from services.election.handlers.create import handler


class CreateTest(unittest.TestCase):
"""
Election Creation Test Suite
Expand All @@ -26,5 +27,6 @@ def test(self):
}
self.assertEqual(handler({}, {}), expected)


if __name__ == '__main__':
unittest.main()