Service for Authorization and Authentication
- AWS CLI - Install the AWS CLI
- You DO NOT have to create an AWS account to use AWS CLI for this project, skip these steps if you don't want to create an AWS account
- AWS CLI looks for credentials when using it, but doesn't validate. So will need to set some fake one. But the region name matters, use any valid region name.
$ aws configure $ AWS Access Key ID: [ANYTHING YOU WANT] $ AWS Secret Access Key: [ANYTHING YOUR HEART DESIRES] $ Default region nam: us-east-1 $ Default output format [None]: (YOU CAN SKIP)
- SAM CLI - Install the SAM CLI
- You DO NOT need to create an aws account to use SAM CLI for this project, skip these steps if you don't want to create an aws account
- Note: if you are getting the following error:
runtime is not supportedwhen runningsam build --use-containermake sure your SAM CLI version is up to date
- Python 3 - Install Python 3
- Docker - Install Docker
Confirm that the following requests work for you
cd AUTH/sam build --use-containersam local invoke HelloWorldFunction --event events/event.json- response:
{"statusCode": 200, "body": "{\"message\": \"hello world - AUTH\"}"}
- response:
sam local start-apicurl http://localhost:3000/hello- response:
{"message": "hello world - AUTH"}
- response:
-
Create a Python virtual environment:
python -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate
-
Install test dependencies:
cd AUTH/ pip install -r tests/requirements.txt -
Install the package in development mode (required for imports and tests):
pip install -e .
Run all unit tests:
pytest tests/unit/ -vRun specific test suite:
# Test post-confirmation handler
pytest tests/unit/test_post_confirmation.py -v
# Test specific function
pytest tests/unit/test_post_confirmation.py -k "test_successful_confirmation"Generate coverage report:
pytest tests/unit/ --cov=src/ --cov-report=term-missing