mirror of
https://github.com/borgbase/vorta
synced 2024-12-22 07:43:09 +00:00
Minor/test fixes (#1150)
* Reorder asserts in test_ssh_dialog * Prevent borg-check from running during tests
This commit is contained in:
parent
8b763a9af9
commit
0390a666e7
2 changed files with 9 additions and 7 deletions
|
@ -55,6 +55,7 @@ def init_db(qapp, qtbot, tmpdir_factory):
|
||||||
|
|
||||||
default_profile.repo = new_repo.id
|
default_profile.repo = new_repo.id
|
||||||
default_profile.dont_run_on_metered_networks = False
|
default_profile.dont_run_on_metered_networks = False
|
||||||
|
default_profile.validation_on = False
|
||||||
default_profile.save()
|
default_profile.save()
|
||||||
|
|
||||||
test_archive = ArchiveModel(snapshot_id='99999', name='test-archive', time=dt(2000, 1, 1, 0, 0), repo=1)
|
test_archive = ArchiveModel(snapshot_id='99999', name='test-archive', time=dt(2000, 1, 1, 0, 0), repo=1)
|
||||||
|
|
|
@ -117,14 +117,15 @@ def test_ssh_dialog(qapp, qtbot, tmpdir):
|
||||||
ssh_dialog.outputFileTextBox.setText(key_tmpfile_full)
|
ssh_dialog.outputFileTextBox.setText(key_tmpfile_full)
|
||||||
ssh_dialog.generate_key()
|
ssh_dialog.generate_key()
|
||||||
|
|
||||||
qtbot.waitUntil(lambda: key_tmpfile.check(file=1), **pytest._wait_defaults)
|
# Ensure new key files exist
|
||||||
qtbot.waitUntil(lambda: pub_tmpfile.check(file=1), **pytest._wait_defaults)
|
|
||||||
|
|
||||||
key_tmpfile_content = key_tmpfile.read()
|
|
||||||
pub_tmpfile_content = pub_tmpfile.read()
|
|
||||||
assert key_tmpfile_content.startswith('-----BEGIN OPENSSH PRIVATE KEY-----')
|
|
||||||
assert pub_tmpfile_content.startswith('ssh-ed25519')
|
|
||||||
qtbot.waitUntil(lambda: ssh_dialog.errors.text().startswith('New key was copied'), **pytest._wait_defaults)
|
qtbot.waitUntil(lambda: ssh_dialog.errors.text().startswith('New key was copied'), **pytest._wait_defaults)
|
||||||
|
assert len(ssh_dir.listdir()) == 2
|
||||||
|
|
||||||
|
# Ensure valid keys were created
|
||||||
|
key_tmpfile_content = key_tmpfile.read()
|
||||||
|
assert key_tmpfile_content.startswith('-----BEGIN OPENSSH PRIVATE KEY-----')
|
||||||
|
pub_tmpfile_content = pub_tmpfile.read()
|
||||||
|
assert pub_tmpfile_content.startswith('ssh-ed25519')
|
||||||
|
|
||||||
ssh_dialog.generate_key()
|
ssh_dialog.generate_key()
|
||||||
qtbot.waitUntil(lambda: ssh_dialog.errors.text().startswith('Key file already'), **pytest._wait_defaults)
|
qtbot.waitUntil(lambda: ssh_dialog.errors.text().startswith('Key file already'), **pytest._wait_defaults)
|
||||||
|
|
Loading…
Reference in a new issue