From 6b190e3960f64d9df50582a179bc67d6209da478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Sch=C3=B6nfelder?= <carl@schonfelder.se> Date: Thu, 1 Apr 2021 14:41:43 +0200 Subject: [PATCH] fix: minor backend changes --- server/app/apis/auth.py | 13 ++++--------- server/app/apis/competitions.py | 2 +- server/app/apis/slides.py | 2 +- server/app/apis/teams.py | 2 +- server/app/apis/users.py | 2 +- server/app/core/{utils => }/http_codes.py | 0 server/app/core/utils/__init__.py | 0 server/tests/test_app.py | 5 +---- server/tests/test_db.py | 4 +--- server/{app/core/utils => tests}/test_helpers.py | 1 - 10 files changed, 10 insertions(+), 21 deletions(-) rename server/app/core/{utils => }/http_codes.py (100%) delete mode 100644 server/app/core/utils/__init__.py rename server/{app/core/utils => tests}/test_helpers.py (99%) diff --git a/server/app/apis/auth.py b/server/app/apis/auth.py index 306392ff..8fe25b6b 100644 --- a/server/app/apis/auth.py +++ b/server/app/apis/auth.py @@ -1,17 +1,12 @@ import app.core.controller as dbc -import app.core.utils.http_codes as codes +import app.core.http_codes as codes from app.apis import admin_required from app.core.dto import AuthDTO from app.core.models import User from app.core.parsers import create_user_parser, login_parser -from flask_jwt_extended import ( - create_access_token, - create_refresh_token, - get_jwt_identity, - get_raw_jwt, - jwt_refresh_token_required, - jwt_required, -) +from flask_jwt_extended import (create_access_token, create_refresh_token, + get_jwt_identity, get_raw_jwt, + jwt_refresh_token_required, jwt_required) from flask_restx import Namespace, Resource, cors api = AuthDTO.api diff --git a/server/app/apis/competitions.py b/server/app/apis/competitions.py index 2fed07aa..ac7384df 100644 --- a/server/app/apis/competitions.py +++ b/server/app/apis/competitions.py @@ -1,5 +1,5 @@ import app.core.controller as dbc -import app.core.utils.http_codes as codes +import app.core.http_codes as codes from app.apis import admin_required from app.core.dto import CompetitionDTO from app.core.models import Competition, Slide, Team diff --git a/server/app/apis/slides.py b/server/app/apis/slides.py index 833b0651..6399ebc7 100644 --- a/server/app/apis/slides.py +++ b/server/app/apis/slides.py @@ -1,5 +1,5 @@ import app.core.controller as dbc -import app.core.utils.http_codes as codes +import app.core.http_codes as codes from app.apis import admin_required from app.core.dto import SlideDTO from app.core.models import Competition, Slide diff --git a/server/app/apis/teams.py b/server/app/apis/teams.py index 0b155f20..02c730bb 100644 --- a/server/app/apis/teams.py +++ b/server/app/apis/teams.py @@ -1,5 +1,5 @@ import app.core.controller as dbc -import app.core.utils.http_codes as codes +import app.core.http_codes as codes from app.apis import admin_required from app.core.dto import TeamDTO from app.core.models import Competition, Team diff --git a/server/app/apis/users.py b/server/app/apis/users.py index 4ea7dee8..43e304c1 100644 --- a/server/app/apis/users.py +++ b/server/app/apis/users.py @@ -1,5 +1,5 @@ import app.core.controller as dbc -import app.core.utils.http_codes as codes +import app.core.http_codes as codes from app.apis import admin_required from app.core.dto import UserDTO from app.core.models import User diff --git a/server/app/core/utils/http_codes.py b/server/app/core/http_codes.py similarity index 100% rename from server/app/core/utils/http_codes.py rename to server/app/core/http_codes.py diff --git a/server/app/core/utils/__init__.py b/server/app/core/utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/server/tests/test_app.py b/server/tests/test_app.py index ce0255c3..ce897883 100644 --- a/server/tests/test_app.py +++ b/server/tests/test_app.py @@ -1,8 +1,5 @@ -import json - -from app.core.utils.test_helpers import add_default_values, delete, get, post, put - from tests import app, client, db +from tests.test_helpers import add_default_values, delete, get, post, put def test_competition(client): diff --git a/server/tests/test_db.py b/server/tests/test_db.py index f670e492..46bd5996 100644 --- a/server/tests/test_db.py +++ b/server/tests/test_db.py @@ -1,9 +1,7 @@ from app.core.models import City, Competition, Media, MediaType, Question, QuestionType, Role, Slide, Style, Team, User -from app.core.utils.test_helpers import add_default_values, assert_exists, assert_insert_fail from tests import app, client, db - -# server/env/Scripts/pytest.exe --cov app server/tests/ +from tests.test_helpers import add_default_values, assert_exists, assert_insert_fail def test_user(client): diff --git a/server/app/core/utils/test_helpers.py b/server/tests/test_helpers.py similarity index 99% rename from server/app/core/utils/test_helpers.py rename to server/tests/test_helpers.py index 648bc27a..dd78fc8a 100644 --- a/server/app/core/utils/test_helpers.py +++ b/server/tests/test_helpers.py @@ -1,7 +1,6 @@ import json import app.core.controller as dbc -import pytest from app.core import db from app.core.models import City, MediaType, QuestionType, Role, Style, User -- GitLab