diff --git a/.github/workflows/api-ci.yml b/.github/workflows/api-ci.yml index 45c89b70..82ee0106 100644 --- a/.github/workflows/api-ci.yml +++ b/.github/workflows/api-ci.yml @@ -57,6 +57,10 @@ jobs: runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: [3.9] + services: postgres: image: postgres:12 @@ -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 }} @@ -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 diff --git a/submit-api/src/submit_api/resources/user.py b/submit-api/src/submit_api/resources/user.py index dc722ac5..2c3bfbdd 100644 --- a/submit-api/src/submit_api/resources/user.py +++ b/submit-api/src/submit_api/resources/user.py @@ -52,8 +52,8 @@ def post(): return created_user, HTTPStatus.CREATED -@cors_preflight('GET, OPTIONS, PATCH, DELETE') -@API.route('/', methods=["PATCH", "GET", "OPTIONS", "DELETE"]) +@cors_preflight('GET, OPTIONS, PUT, DELETE') +@API.route('/', methods=["PUT", "GET", "OPTIONS", "DELETE"]) class User(Resource): """Resource for managing a single user""" @@ -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) diff --git a/submit-api/tests/conftest.py b/submit-api/tests/conftest.py index 0b07412a..a6e843ed 100644 --- a/submit-api/tests/conftest.py +++ b/submit-api/tests/conftest.py @@ -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 @@ -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.""" diff --git a/submit-api/tests/unit/utils/test_notification.py b/submit-api/tests/unit/utils/test_notification.py deleted file mode 100644 index e0615cbc..00000000 --- a/submit-api/tests/unit/utils/test_notification.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright © 2024 Province of British Columbia -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Tests to assure the Notification utilities. - -Test-Suite to ensure that the Notification methods are working as expected. -""" - -import pytest - -from submit_api.utils import notification - - -@pytest.mark.parametrize('test_input_email,expected', - [('helo@gw.com', True), ('helo', False), (None, False), ('', False)]) -def test_is_valid_email(test_input_email, expected): - """Assert that the valid email method works well..""" - assert notification.is_valid_email(test_input_email) == expected