mirror of https://github.com/borgbase/vorta
Add mount option override checkbox. By @samuel-w (#682)
* Tests: avoid clicking other window
This commit is contained in:
parent
9a4bbf0d65
commit
95d964c40f
|
@ -1,5 +1,6 @@
|
|||
import os
|
||||
from .borg_thread import BorgThread
|
||||
from vorta.models import SettingsModel
|
||||
|
||||
|
||||
class BorgMountThread(BorgThread):
|
||||
|
@ -15,7 +16,15 @@ class BorgMountThread(BorgThread):
|
|||
else:
|
||||
ret['ok'] = False # Set back to false, so we can do our own checks here.
|
||||
|
||||
cmd = ['borg', '--log-json', 'mount', '-o', f"umask=0277,uid={os.getuid()}", f"{profile.repo.url}"]
|
||||
cmd = ['borg', '--log-json', 'mount']
|
||||
|
||||
# Try to override existing permissions when mounting an archive. May help to read
|
||||
# files that come from a different system, like a restrictive NAS.
|
||||
override_mount_permissions = SettingsModel.get(key='override_mount_permissions').value
|
||||
if override_mount_permissions:
|
||||
cmd += ['-o', f"umask=0277,uid={os.getuid()}"]
|
||||
|
||||
cmd += [f"{profile.repo.url}"]
|
||||
|
||||
ret['ok'] = True
|
||||
ret['cmd'] = cmd
|
||||
|
|
|
@ -225,6 +225,11 @@ def get_misc_settings():
|
|||
'label': trans_late('settings',
|
||||
'Get statistics of file/folder when added')
|
||||
},
|
||||
{
|
||||
'key': 'override_mount_permissions', 'value': False, 'type': 'checkbox',
|
||||
'label': trans_late('settings',
|
||||
'Try to replace existing permissions when mounting an archive.')
|
||||
},
|
||||
{
|
||||
'key': 'previous_profile_id', 'str_value': '1', 'type': 'internal',
|
||||
'label': 'Previously selected profile'
|
||||
|
@ -237,7 +242,6 @@ def get_misc_settings():
|
|||
'key': 'previous_window_height', 'str_value': '600', 'type': 'internal',
|
||||
'label': 'Previous window height'
|
||||
},
|
||||
|
||||
]
|
||||
if sys.platform == 'darwin':
|
||||
settings += [
|
||||
|
|
|
@ -91,12 +91,9 @@ def test_repo_add_success(qapp, qtbot, mocker, borg_json_output):
|
|||
popen_result = mocker.MagicMock(stdout=stdout, stderr=stderr, returncode=0)
|
||||
mocker.patch.object(vorta.borg.borg_thread, 'Popen', return_value=popen_result)
|
||||
|
||||
qtbot.mouseClick(add_repo_window.saveButton, QtCore.Qt.LeftButton)
|
||||
add_repo_window.run()
|
||||
qtbot.waitUntil(lambda: EventLogModel.select().count() == 2, **pytest._wait_defaults)
|
||||
|
||||
with qtbot.waitSignal(add_repo_window.thread.result, **pytest._wait_defaults) as _:
|
||||
pass
|
||||
|
||||
assert EventLogModel.select().count() == 2
|
||||
assert RepoModel.get(id=2).url == test_repo_url
|
||||
|
||||
keyring = VortaKeyring.get_keyring()
|
||||
|
|
Loading…
Reference in New Issue