diff --git a/rhodecode/api/tests/utils.py b/rhodecode/api/tests/utils.py --- a/rhodecode/api/tests/utils.py +++ b/rhodecode/api/tests/utils.py @@ -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 diff --git a/rhodecode/lib/str_utils.py b/rhodecode/lib/str_utils.py --- a/rhodecode/lib/str_utils.py +++ b/rhodecode/lib/str_utils.py @@ -62,7 +62,7 @@ def safe_float(val, default=None) -> flo 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() diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ - # Copyright (C) 2010-2023 RhodeCode GmbH # # This program is free software: you can redistribute it and/or modify