1313@pytest .mark .skipif ("NC_AUTH_USER" not in environ or "NC_AUTH_PASS" not in environ , reason = "Needs login & paasword." )
1414@pytest .mark .skipif (environ .get ("CI" , None ) is None , reason = "run only on GitHub" )
1515def test_password_confirmation (nc_client ):
16- patch_path , cwd_path = _test_password_confirmation ()
16+ patch_path , cwd_path = _test_password_confirmation (nc_client . srv_version [ "major" ] )
1717 nc_client .update_server_info ()
1818 old_adapter = nc_client ._session .adapter
1919 with contextlib .suppress (NextcloudException ):
@@ -27,7 +27,7 @@ def test_password_confirmation(nc_client):
2727@pytest .mark .skipif ("NC_AUTH_USER" not in environ or "NC_AUTH_PASS" not in environ , reason = "Needs login & paasword." )
2828@pytest .mark .skipif (environ .get ("CI" , None ) is None , reason = "run only on GitHub" )
2929async def test_password_confirmation_async (anc_client ):
30- patch_path , cwd_path = _test_password_confirmation ()
30+ patch_path , cwd_path = _test_password_confirmation (( await anc_client . srv_version )[ "major" ] )
3131 await anc_client .update_server_info ()
3232 old_adapter = anc_client ._session .adapter
3333 with contextlib .suppress (NextcloudException ):
@@ -37,9 +37,12 @@ async def test_password_confirmation_async(anc_client):
3737 run (["git" , "apply" , "-R" , patch_path ], cwd = cwd_path , check = True )
3838
3939
40- def _test_password_confirmation () -> tuple [str , str ]:
40+ def _test_password_confirmation (nc_version ) -> tuple [str , str ]:
4141 # patch "PasswordConfirmationMiddleware.php" decreasing asking before Password Confirmation from 30 min to 5 secs
42- patch_path = path .join (path .dirname (path .dirname (path .abspath (__file__ ))), "data/nc_pass_confirm.patch" )
42+ if nc_version <= 30 :
43+ patch_path = path .join (path .dirname (path .dirname (path .abspath (__file__ ))), "data/nc_pass_confirm.patch" )
44+ else :
45+ patch_path = path .join (path .dirname (path .dirname (path .abspath (__file__ ))), "data/nc_pass_confirm_nc31.patch" )
4346 cwd_path = path .dirname (path .dirname (path .dirname (path .dirname (path .abspath (__file__ )))))
4447 run (["patch" , "-p" , "1" , "-i" , patch_path ], cwd = cwd_path , check = True )
4548 sleep (6 )
0 commit comments