Skip to content

Commit

Permalink
Merge pull request #4 from jadmsaadaot/test-api-workflow
Browse files Browse the repository at this point in the history
Fix linting issues
  • Loading branch information
jadmsaadaot authored Jul 12, 2024
2 parents dffa118 + ed00850 commit c7676ef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 48 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/api-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ jobs:

runs-on: ubuntu-20.04

strategy:
matrix:
python-version: [3.9]

services:
postgres:
image: postgres:12
Expand All @@ -70,7 +74,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -103,6 +107,9 @@ jobs:
build:
# needs: PyTest
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.9]
name: Build
steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions submit-api/src/submit_api/resources/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def post():
return created_user, HTTPStatus.CREATED


@cors_preflight('GET, OPTIONS, PATCH, DELETE')
@API.route('/<user_id>', methods=["PATCH", "GET", "OPTIONS", "DELETE"])
@cors_preflight('GET, OPTIONS, PUT, DELETE')
@API.route('/<user_id>', methods=["PUT", "GET", "OPTIONS", "DELETE"])
class User(Resource):
"""Resource for managing a single user"""

Expand All @@ -68,7 +68,7 @@ def get(user_id):
@staticmethod
@cross_origin(origins=allowedorigins())
@auth.require
def patch(user_id):
def put(user_id):
"""Update a user by id."""
user_data = request.get_json()
updated_user = UserService.update_user(user_id, user_data)
Expand Down
16 changes: 1 addition & 15 deletions submit-api/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from flask_migrate import Migrate, upgrade
from sqlalchemy import event, text

from api import create_app, setup_jwt_manager
from submit_api import create_app, setup_jwt_manager
from submit_api.auth import jwt as _jwt
from submit_api.models import db as _db

Expand Down Expand Up @@ -136,20 +136,6 @@ def client_id():
return f'client-{_id}'


@pytest.fixture(scope='session', autouse=True)
def auto(docker_services, app):
"""Spin up a keycloak instance and initialize jwt."""
if app.config['USE_TEST_KEYCLOAK_DOCKER']:
docker_services.start('keycloak')
docker_services.wait_for_service('keycloak', 8081)

setup_jwt_manager(app, _jwt)

if app.config['USE_DOCKER_MOCK']:
docker_services.start('proxy')
time.sleep(10)


@pytest.fixture(scope='session')
def docker_compose_files(pytestconfig):
"""Get the docker-compose.yml absolute path."""
Expand Down
29 changes: 0 additions & 29 deletions submit-api/tests/unit/utils/test_notification.py

This file was deleted.

0 comments on commit c7676ef

Please sign in to comment.