Fixing pep8 reports
This commit is contained in:
parent
b61f59f9f2
commit
4bd2da9fb4
3 changed files with 6 additions and 5 deletions
|
@ -19,6 +19,7 @@ import flask
|
||||||
|
|
||||||
error_pages = flask.Blueprint('error_pages', __name__, template_folder='templates')
|
error_pages = flask.Blueprint('error_pages', __name__, template_folder='templates')
|
||||||
|
|
||||||
|
|
||||||
@error_pages.app_errorhandler(404)
|
@error_pages.app_errorhandler(404)
|
||||||
def page_not_found_error(e):
|
def page_not_found_error(e):
|
||||||
return flask.render_template("404.html"), 404
|
return flask.render_template("404.html"), 404
|
||||||
|
|
|
@ -42,8 +42,8 @@ def upload():
|
||||||
score = int(content['score'])
|
score = int(content['score'])
|
||||||
except KeyError: # Json doesn't contain the keys we need.
|
except KeyError: # Json doesn't contain the keys we need.
|
||||||
error = "invalid json keys: gpu, cpu, log, score"
|
error = "invalid json keys: gpu, cpu, log, score"
|
||||||
return json.dumps({'error': error,'success': False}), 400, {'ContentType': 'application/json'}
|
return json.dumps({'error': error, 'success': False}), 400, {'ContentType': 'application/json'}
|
||||||
except TypeError: # The types from the json object are not correct.
|
except TypeError: # The types from the json object are not correct.
|
||||||
error = "invalid json object"
|
error = "invalid json object"
|
||||||
return json.dumps({'error': error, 'success': False}), 400, {'ContentType': 'application/json'}
|
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'}
|
return json.dumps({'success': True}), 200, {'ContentType': 'application/json'}
|
||||||
|
|
||||||
|
|
||||||
@scoreboard.route("/entry/<id>")
|
@scoreboard.route("/entry/<id>")
|
||||||
def entry(id):
|
def entry(id):
|
||||||
"""
|
"""
|
||||||
|
@ -66,6 +67,7 @@ def entry(id):
|
||||||
|
|
||||||
flask.abort(404)
|
flask.abort(404)
|
||||||
|
|
||||||
|
|
||||||
@scoreboard.route("/")
|
@scoreboard.route("/")
|
||||||
def index():
|
def index():
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -59,9 +59,7 @@ class ScoreboardTestCase(unittest.TestCase):
|
||||||
log="This is a logfile",
|
log="This is a logfile",
|
||||||
score=200
|
score=200
|
||||||
)
|
)
|
||||||
response = self.client.post('/upload',
|
response = self.client.post('/upload', data=json.dumps(data), content_type='application/json')
|
||||||
data=json.dumps(data),
|
|
||||||
content_type='application/json')
|
|
||||||
|
|
||||||
self.assertTrue("true" in response.get_data(as_text=True))
|
self.assertTrue("true" in response.get_data(as_text=True))
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
Loading…
Reference in a new issue