From 4bd2da9fb4a5046222ac2dd5fd6dce31996143d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nut=CC=A6iu?= Date: Sun, 16 Apr 2017 00:25:01 +0300 Subject: [PATCH] Fixing pep8 reports --- src/views/errors.py | 1 + src/views/scoreboard.py | 6 ++++-- test/test_scoreboard.py | 4 +--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/views/errors.py b/src/views/errors.py index 1c7e65f..a26309e 100644 --- a/src/views/errors.py +++ b/src/views/errors.py @@ -19,6 +19,7 @@ import flask error_pages = flask.Blueprint('error_pages', __name__, template_folder='templates') + @error_pages.app_errorhandler(404) def page_not_found_error(e): return flask.render_template("404.html"), 404 diff --git a/src/views/scoreboard.py b/src/views/scoreboard.py index cc26b85..a687f96 100644 --- a/src/views/scoreboard.py +++ b/src/views/scoreboard.py @@ -42,8 +42,8 @@ def upload(): score = int(content['score']) except KeyError: # Json doesn't contain the keys we need. error = "invalid json keys: gpu, cpu, log, score" - return json.dumps({'error': error,'success': False}), 400, {'ContentType': 'application/json'} - except TypeError: # The types from the json object are not correct. + return json.dumps({'error': error, 'success': False}), 400, {'ContentType': 'application/json'} + except TypeError: # The types from the json object are not correct. error = "invalid json object" return json.dumps({'error': error, 'success': False}), 400, {'ContentType': 'application/json'} @@ -54,6 +54,7 @@ def upload(): return json.dumps({'success': True}), 200, {'ContentType': 'application/json'} + @scoreboard.route("/entry/") def entry(id): """ @@ -66,6 +67,7 @@ def entry(id): flask.abort(404) + @scoreboard.route("/") def index(): """ diff --git a/test/test_scoreboard.py b/test/test_scoreboard.py index b6c44b0..931f2a7 100644 --- a/test/test_scoreboard.py +++ b/test/test_scoreboard.py @@ -59,9 +59,7 @@ class ScoreboardTestCase(unittest.TestCase): log="This is a logfile", score=200 ) - response = self.client.post('/upload', - data=json.dumps(data), - content_type='application/json') + response = self.client.post('/upload', data=json.dumps(data), content_type='application/json') self.assertTrue("true" in response.get_data(as_text=True)) self.assertEqual(response.status_code, 200)