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.app_errorhandler(404)
|
||||
def page_not_found_error(e):
|
||||
return flask.render_template("404.html"), 404
|
||||
|
|
|
@ -42,7 +42,7 @@ 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'}
|
||||
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/<id>")
|
||||
def entry(id):
|
||||
"""
|
||||
|
@ -66,6 +67,7 @@ def entry(id):
|
|||
|
||||
flask.abort(404)
|
||||
|
||||
|
||||
@scoreboard.route("/")
|
||||
def index():
|
||||
"""
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue