Improve guard security integration #219
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: Integration Test | |
| on: [push, workflow_call, pull_request] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| app_type: ["Blank", "SyncORM", "AsyncORM"] | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: | | |
| pip install poetry | |
| poetry install | |
| - name: Start Application | |
| run: | | |
| if [ "${{ matrix.app_type }}" == "Blank" ]; then | |
| app_name="NestApp" | |
| is_async="" | |
| elif [ "${{ matrix.app_type }}" == "SyncORM" ]; then | |
| app_name="ORMNestApp" | |
| is_async="" | |
| elif [ "${{ matrix.app_type }}" == "AsyncORM" ]; then | |
| app_name="AsyncORMNestApp" | |
| is_async="--is-async" | |
| fi | |
| if [ "${{ matrix.app_type }}" == "Blank" ]; then | |
| poetry run pynest generate application -n "$app_name" | |
| else | |
| poetry run pynest generate application -n "$app_name" -db sqlite $is_async | |
| poetry add aiosqlite | |
| fi | |
| cd "$app_name" | |
| poetry run pynest generate resource -n user | |
| poetry run uvicorn "src.app_module:http_server" --host "0.0.0.0" --port 8000 --reload & | |
| - name: Wait for the server to start | |
| run: sleep 10 | |
| - name: Test the application | |
| run: | | |
| curl -f http://localhost:8000/docs | |
| curl -f -X 'POST' \ | |
| "http://localhost:8000/user/" \ | |
| -H 'accept: application/json' \ | |
| -H 'Content-Type: application/json' \ | |
| -d '{"name": "Example Name"}' | |
| curl -f http://localhost:8000/user/ | |
| - name: Kill the server | |
| run: kill $(jobs -p) || true |