diff --git a/.eslintrc.json b/.eslintrc.json index 7ea5a2b5..113aae57 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -376,7 +376,13 @@ "import/no-named-as-default": "warn", "import/no-named-as-default-member": "warn", "import/no-deprecated": "warn", - "import/no-extraneous-dependencies": "warn", + "import/no-extraneous-dependencies": [ + "warn", + { + "devDependencies": true, + "packageDir": "." + } + ], "import/no-mutable-exports": "warn", "import/unambiguous": "off", "import/no-commonjs": "off", diff --git a/Makefile.config b/Makefile.config index 9a9b91db..0752ddf9 100644 --- a/Makefile.config +++ b/Makefile.config @@ -5,7 +5,7 @@ CLIENT_PORT = 3000 export REACT_APP_API_URL = http://$(HOST):$(API_PORT) export FLASK_APP = $(PWD)/mpwo_api/server.py export APP_SETTINGS=mpwo_api.config.DevelopmentConfig -export FLASK_DEBUG = 1 +export FLASK_ENV=development export TEST_URL = http://$(HOST):$(CLIENT_PORT) export REQUIREMENTS = $(PWD)/mpwo_api/requirements.txt export DATABASE_URL = postgres://mpwo:mpwo@$(HOST):5432/mpwo diff --git a/mpwo_api/mpwo_api/activities/activities.py b/mpwo_api/mpwo_api/activities/activities.py index 5281d6a7..e14f10c6 100644 --- a/mpwo_api/mpwo_api/activities/activities.py +++ b/mpwo_api/mpwo_api/activities/activities.py @@ -153,17 +153,12 @@ def delete_sport(auth_user_id, sport_id): try: sport = Sport.query.filter_by(id=sport_id).first() if sport: - db.session.query(Sport).filter_by(id=sport_id).delete() + db.session.delete(sport) db.session.commit() response_object = { - 'status': 'no content', - 'data': { - 'sports': sports_list - } + 'status': 'no content' } code = 204 - print('OK') - print(response_object) else: response_object = { 'status': 'not found', diff --git a/mpwo_api/mpwo_api/config.py b/mpwo_api/mpwo_api/config.py index 0b6d8291..87d93744 100644 --- a/mpwo_api/mpwo_api/config.py +++ b/mpwo_api/mpwo_api/config.py @@ -20,8 +20,7 @@ class BaseConfig: class DevelopmentConfig(BaseConfig): """Development configuration""" DEBUG = True - SQLALCHEMY_DATABASE_URI = \ - os.environ.get('DATABASE_URL') + SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') SECRET_KEY = 'development key' USERNAME = 'admin' PASSWORD = 'default' @@ -32,8 +31,7 @@ class TestingConfig(BaseConfig): """Testing configuration""" DEBUG = True TESTING = True - SQLALCHEMY_DATABASE_URI = \ - os.environ.get('DATABASE_TEST_URL') + SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_TEST_URL') SECRET_KEY = 'test key' USERNAME = 'admin' PASSWORD = 'default' diff --git a/mpwo_api/mpwo_api/tests/conftest.py b/mpwo_api/mpwo_api/tests/conftest.py index dff9af00..2f4f3506 100644 --- a/mpwo_api/mpwo_api/tests/conftest.py +++ b/mpwo_api/mpwo_api/tests/conftest.py @@ -1,11 +1,15 @@ +import os + import pytest from mpwo_api import create_app, db +os.environ["FLASK_ENV"] = 'testing' +os.environ["APP_SETTINGS"] = 'mpwo_api.config.TestingConfig' + @pytest.fixture def app(): app = create_app() - app.config.from_object('mpwo_api.config.TestingConfig') with app.app_context(): db.create_all() yield app diff --git a/mpwo_client/src/components/Admin/generic/AdminDetail.jsx b/mpwo_client/src/components/Admin/generic/AdminDetail.jsx index 068b2bfb..a62fbb74 100644 --- a/mpwo_client/src/components/Admin/generic/AdminDetail.jsx +++ b/mpwo_client/src/components/Admin/generic/AdminDetail.jsx @@ -1,7 +1,6 @@ import React from 'react' import { Helmet } from 'react-helmet' import { connect } from 'react-redux' -import { Link } from 'react-router-dom' import { deleteData, updateData } from '../../../actions/index' diff --git a/mpwo_client/src/components/Admin/generic/AdminPage.jsx b/mpwo_client/src/components/Admin/generic/AdminPage.jsx index a0966b7d..3936d4ec 100644 --- a/mpwo_client/src/components/Admin/generic/AdminPage.jsx +++ b/mpwo_client/src/components/Admin/generic/AdminPage.jsx @@ -39,6 +39,7 @@ export default function AdminPage(props) {
{ results.map((result, idx) => ( + // eslint-disable-next-line react/no-array-index-key