config fix
* FLASK_ENV (new in Flask 1.0) * eslint config (corrects directories and rules) * minor fixes Note: still having problems w/ database used by pytest
This commit is contained in:
parent
e423c355b5
commit
fd8b51f416
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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',
|
||||
|
@ -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'
|
||||
|
@ -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
|
||||
|
@ -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'
|
||||
|
||||
|
@ -39,6 +39,7 @@ export default function AdminPage(props) {
|
||||
</thead>
|
||||
<tbody>
|
||||
{ results.map((result, idx) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<tr key={idx}>
|
||||
{ Object.keys(result).map(key => {
|
||||
if (key === 'id') {
|
||||
|
@ -21,7 +21,7 @@
|
||||
"build": "cd mpwo_client && react-scripts build",
|
||||
"test": "cd mpwo_client && testcafe firefox e2e",
|
||||
"eject": "cd mpwo_client && react-scripts eject",
|
||||
"lint": "eslint --cache --ext .jsx --ext .js mpwo/src"
|
||||
"lint": "eslint --cache --ext .jsx --ext .js mpwo_client/src"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-eslint": "^8.0.3",
|
||||
|
Loading…
Reference in New Issue
Block a user