diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-10-26 16:19:55 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-04-04 12:48:04 +0200 |
| commit | f0c472b1792779e63fdeb97a470b46300de00050 (patch) | |
| tree | 99646cf4448f4f73c2c98ede338df19a1497f9b5 /opendc-web/opendc-web-api/conftest.py | |
| parent | 8f958c5a578dc11b890c96c0dc48e3e3f92a4d07 (diff) | |
feat(web/api): Initial API implementation in Kotlin
This change adds the initial implementation of the new API server in Kotlin,
replacing the old API written in Python. The implementation uses Quarkus,
RESTEasy, and Hibernate to implement the new API endpoints.
The reason for replacing the old API server is unifying the build and
deployment toolchains, reducing the number of technologies necessary to
work with OpenDC. Furthermore, we envision bundling the entire OpenDC
project into a single distributions, allowing users to launch their own
deployment trivially.
Diffstat (limited to 'opendc-web/opendc-web-api/conftest.py')
| -rw-r--r-- | opendc-web/opendc-web-api/conftest.py | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/opendc-web/opendc-web-api/conftest.py b/opendc-web/opendc-web-api/conftest.py deleted file mode 100644 index 958a5894..00000000 --- a/opendc-web/opendc-web-api/conftest.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -Configuration file for all unit tests. -""" - -from functools import wraps -import pytest -from flask import _request_ctx_stack, g -from opendc.database import Database - - -def requires_auth_mock(f): - @wraps(f) - def decorated_function(*args, **kwargs): - _request_ctx_stack.top.current_user = {'sub': 'test'} - return f(*args, **kwargs) - return decorated_function - - -def requires_scope_mock(required_scope): - def decorator(f): - @wraps(f) - def decorated_function(*args, **kwargs): - return f(*args, **kwargs) - return decorated_function - return decorator - - -@pytest.fixture -def client(): - """Returns a Flask API client to interact with.""" - - # Disable authorization for test API endpoints - from opendc import exts - exts.requires_auth = requires_auth_mock - exts.requires_scope = requires_scope_mock - exts.has_scope = lambda x: False - - from app import create_app - - app = create_app(testing=True) - - with app.app_context(): - g.db = Database() - with app.test_client() as client: - yield client |
