Skip to content

Commit

Permalink
Conform to current API v2
Browse files Browse the repository at this point in the history
Add a test to conform API v2 and its erroneous status. Should be rewritten for v3.
  • Loading branch information
stephanepechard committed Nov 5, 2015
1 parent c46b081 commit 326523e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions photobackup_bottle/photobackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def end(code, message):
abort(code, message)


def validate_password(request):
def validate_password(request, isTest = False):
password = request.forms.get('password').encode('utf-8')

if 'PasswordBcrypt' in config:
Expand All @@ -83,7 +83,7 @@ def validate_password(request):
end(403, "wrong password!")
elif 'Password' in config and config['Password'] != password:
end(403, "wrong password!")
else:
elif isTest:
end(401, "There's no password in server configuration!")


Expand Down Expand Up @@ -133,7 +133,7 @@ def save_image():

@route('/test', method='POST')
def test():
validate_password(request)
validate_password(request, True)

if not os.path.exists(config['MediaRoot']):
end(500, "'MediaRoot' directory does not exist!")
Expand Down

0 comments on commit 326523e

Please sign in to comment.