13
13
@pytest .mark .skipif ("NC_AUTH_USER" not in environ or "NC_AUTH_PASS" not in environ , reason = "Needs login & paasword." )
14
14
@pytest .mark .skipif (environ .get ("CI" , None ) is None , reason = "run only on GitHub" )
15
15
def 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" ] )
17
17
nc_client .update_server_info ()
18
18
old_adapter = nc_client ._session .adapter
19
19
with contextlib .suppress (NextcloudException ):
@@ -27,7 +27,7 @@ def test_password_confirmation(nc_client):
27
27
@pytest .mark .skipif ("NC_AUTH_USER" not in environ or "NC_AUTH_PASS" not in environ , reason = "Needs login & paasword." )
28
28
@pytest .mark .skipif (environ .get ("CI" , None ) is None , reason = "run only on GitHub" )
29
29
async 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" ] )
31
31
await anc_client .update_server_info ()
32
32
old_adapter = anc_client ._session .adapter
33
33
with contextlib .suppress (NextcloudException ):
@@ -37,9 +37,12 @@ async def test_password_confirmation_async(anc_client):
37
37
run (["git" , "apply" , "-R" , patch_path ], cwd = cwd_path , check = True )
38
38
39
39
40
- def _test_password_confirmation () -> tuple [str , str ]:
40
+ def _test_password_confirmation (nc_version ) -> tuple [str , str ]:
41
41
# 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" )
43
46
cwd_path = path .dirname (path .dirname (path .dirname (path .dirname (path .abspath (__file__ )))))
44
47
run (["patch" , "-p" , "1" , "-i" , patch_path ], cwd = cwd_path , check = True )
45
48
sleep (6 )
0 commit comments