@@ -76,9 +76,10 @@ def test_acs_handler_factory(appctx, db):
7676
7777 acs_handler = acs_handler_factory ("test" )
7878
79- with appctx .test_request_context (), patch (
80- "invenio_saml.utils.SAMLAuth"
81- ) as mock_saml_auth :
79+ with (
80+ appctx .test_request_context (),
81+ patch ("invenio_saml.utils.SAMLAuth" ) as mock_saml_auth ,
82+ ):
8283 mock_saml_auth .get_attributes .return_value = attrs
8384 next_url = acs_handler (mock_saml_auth , "/foo" )
8485
@@ -110,9 +111,10 @@ def test_acs_handler_factory_config(appctx, db):
110111
111112 acs_handler = acs_handler_factory ("test" )
112113
113- with appctx .test_request_context (), patch (
114- "invenio_saml.utils.SAMLAuth"
115- ) as mock_saml_auth :
114+ with (
115+ appctx .test_request_context (),
116+ patch ("invenio_saml.utils.SAMLAuth" ) as mock_saml_auth ,
117+ ):
116118 mock_saml_auth .get_attributes .return_value = attrs
117119 acs_handler (mock_saml_auth , "/foo" )
118120
@@ -131,11 +133,11 @@ def test_acs_handler_authetication_error(appctx, db):
131133
132134 acs_handler = acs_handler_factory ("test" )
133135
134- with appctx . test_request_context (), patch (
135- "invenio_saml.utils.SAMLAuth"
136- ) as mock_saml_auth , patch (
137- "invenio_saml.handlers.account_authenticate"
138- ) as mock_authenticate :
136+ with (
137+ appctx . test_request_context (),
138+ patch ( "invenio_saml.utils.SAMLAuth" ) as mock_saml_auth ,
139+ patch ( "invenio_saml.handlers.account_authenticate" ) as mock_authenticate ,
140+ ):
139141 mock_saml_auth .get_attributes .return_value = attrs
140142 mock_authenticate .return_value = False
141143 with pytest .raises (Unauthorized ):
@@ -153,11 +155,11 @@ def test_acs_handler_user_creation_error(appctx, db):
153155
154156 acs_handler = acs_handler_factory ("test" )
155157
156- with appctx . test_request_context (), patch (
157- "invenio_saml.utils.SAMLAuth"
158- ) as mock_saml_auth , patch (
159- "invenio_saml.handlers.account_register"
160- ) as mock_register :
158+ with (
159+ appctx . test_request_context (),
160+ patch ( "invenio_saml.utils.SAMLAuth" ) as mock_saml_auth ,
161+ patch ( "invenio_saml.handlers.account_register" ) as mock_register ,
162+ ):
161163 mock_saml_auth .get_attributes .return_value = attrs
162164 mock_register .return_value = None
163165 with pytest .raises (Unauthorized ):
@@ -200,9 +202,10 @@ def account_info(attributes, remote_app):
200202
201203 acs_handler = acs_handler_factory ("test" , account_info = account_info )
202204
203- with appctx .test_request_context (), patch (
204- "invenio_saml.utils.SAMLAuth"
205- ) as mock_saml_auth :
205+ with (
206+ appctx .test_request_context (),
207+ patch ("invenio_saml.utils.SAMLAuth" ) as mock_saml_auth ,
208+ ):
206209 mock_saml_auth .get_attributes .return_value = attrs
207210 acs_handler (mock_saml_auth , "/" )
208211
@@ -235,9 +238,10 @@ def test_custom_user_lookup(appctx, users):
235238
236239 acs_handler = acs_handler_factory ("test" , user_lookup = mock_user_lookup )
237240
238- with appctx .test_request_context (), patch (
239- "invenio_saml.utils.SAMLAuth"
240- ) as mock_saml_auth :
241+ with (
242+ appctx .test_request_context (),
243+ patch ("invenio_saml.utils.SAMLAuth" ) as mock_saml_auth ,
244+ ):
241245 mock_saml_auth .get_attributes .return_value = attrs
242246 acs_handler (mock_saml_auth , "/" )
243247
0 commit comments