From f81c25d6dd965212bec3124a74deac4bd8eb9b35 Mon Sep 17 00:00:00 2001 From: mprahl Date: Mar 20 2019 20:06:32 +0000 Subject: Fix the failing test of test_auth_header_not_set --- diff --git a/module_build_service/auth.py b/module_build_service/auth.py index 6c6b038..ab88edb 100644 --- a/module_build_service/auth.py +++ b/module_build_service/auth.py @@ -244,7 +244,11 @@ def get_user_kerberos(request): user = None if 'Authorization' not in request.headers: response = Response('Unauthorized', 401, {'WWW-Authenticate': 'Negotiate'}) - raise FlaskUnauthorized(response=response) + exc = FlaskUnauthorized() + # For some reason, certain versions of werkzeug raise an exception when passing `response` + # in the constructor. This is a work-around. + exc.response = response + raise exc header = request.headers.get('Authorization') token = ''.join(header.strip().split()[1:]) user, kerberos_token = KerberosAuthenticate().process_request(token)