# lambda-documents-tests
This is a pytest-based integration test automation framework for lambda-documents

### Requirements
* AWS User Permissions: Ensure your AWS user has access to the [cypress application family](https://www.notion.so/AWS-Engineer-Permissions-Model-24f9c067f6ea4b0d986401b717bde731#674d5d917db247ab81bee93f20bdeb52) 
* MFA Session: Make sure you have an active MFA session using  `awsume`
* Python Version: Python 3.11 or higher is required
* Execution Directory: All tests must be run from the `lambda-documents/tests` directory.

### Quickstart
You can run the lambda integration tests for a lambda function or cross lambda tests in two ways:
* In a Docker container, for example:
    ```
    # This runs lambda integration tests
    make docker_run_integration_tests function='lambda_name'
    
    # This runs cross lambda tests
    make docker_run_cross_lambda_tests
    ```
* OR, locally in a virtual environment:
  * Setup virtual environment:
    ```
    python -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    ```
  * Run the tests:
    ```
    # This runs lambda integration tests
    make test_integration function='lambda_name'
      
    # This runs cross lambda tests
    make test_cross
    ```

* You can find the test report in `tests/report/`

### Style Guide
* We use `ruff` for linting and formatting. Please run the following before committing your code.
    ```
    # This automatically formats the code with ruff
    make format
    
    # This checks for linting and mypy issues
    make lint
    ```