Merge pull request #61 from DanielGrams/issue/60-log-level

Decrease log level #60
This commit is contained in:
Daniel Grams 2021-01-18 11:39:19 +01:00 committed by GitHub
commit e11561d028
5 changed files with 20 additions and 6 deletions

View File

@ -16,10 +16,6 @@ from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
from flask_apispec.extension import FlaskApiSpec
import pathlib
import logging
logging.basicConfig()
logging.getLogger("sqlalchemy.engine").setLevel(logging.INFO)
# Create app
app = Flask(__name__)

View File

@ -21,7 +21,7 @@ from project.api.organizer.schemas import OrganizerDumpSchema
from project.api.image.schemas import ImageDumpSchema
from project.api.organization.schemas import OrganizationDumpSchema
from project.api.event_reference.schemas import EventReferenceDumpSchema
import os.path
import os
import shutil
import pathlib
@ -42,7 +42,12 @@ def dump_items(items, schema, file_base_name, dump_path):
def dump_all():
# Setup temp dir
tmp_path = os.path.join(dump_path, "tmp")
pathlib.Path(tmp_path).mkdir(parents=True, exist_ok=True)
try:
original_umask = os.umask(0)
pathlib.Path(tmp_path).mkdir(parents=True, exist_ok=True)
finally:
os.umask(original_umask)
# Events
events = Event.query.options(joinedload(Event.categories)).all()

View File

@ -65,5 +65,7 @@ def developer():
"size": os.path.getsize(all_path),
"ctime": os.path.getctime(all_path),
}
else:
print("No file at %s" % all_path)
return render_template("developer/read.html", dump_file=dump_file)

View File

@ -6,4 +6,5 @@ def test_all(client, seeder, app, utils):
result = runner.invoke(args=["dump", "all"])
assert "Zipped all up" in result.output
utils.get_endpoint_ok("developer")
utils.get_endpoint_ok("dump_files", path="all.zip")

View File

@ -1,3 +1,7 @@
import os
from project import dump_path
def test_home(client, seeder, utils):
url = utils.get_url("home")
utils.get_ok(url)
@ -65,5 +69,11 @@ def test_privacy(app, db, utils):
def test_developer(client, seeder, utils):
file_name = "all.zip"
all_path = os.path.join(dump_path, file_name)
if os.path.exists(all_path):
os.remove(all_path)
url = utils.get_url("developer")
utils.get_ok(url)