cleanups: typing + whitespaces

This commit is contained in:
RhodeCode Admin 2023-07-20 10:33:37 +02:00
parent f14b0f8225
commit b4c874e244
3 changed files with 6 additions and 3 deletions

View file

@ -83,10 +83,14 @@ def build_data(apikey, method, **kw):
})
def api_call(app, params, status=None):
def api_call(app, params, status=None, assert_no_error=False):
response = app.post(
API_URL, content_type='application/json', params=params, status=status,
headers=[('Content-Type', 'application/json')])
if assert_no_error:
err_resp = response.json.get('error')
if err_resp:
raise AssertionError(f'ERROR in response: {err_resp}')
return response

View file

@ -62,7 +62,7 @@ def safe_float(val, default=None) -> float:
return val
def base64_to_str(text) -> str:
def base64_to_str(text: str | bytes) -> str:
return safe_str(base64.encodebytes(safe_bytes(text))).strip()

View file

@ -1,4 +1,3 @@
# Copyright (C) 2010-2023 RhodeCode GmbH
#
# This program is free software: you can redistribute it and/or modify