Skip to content

Commit

Permalink
fixed bug in ssh combo box refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtedde committed Aug 30, 2023
1 parent bb2d874 commit 999732e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/vorta/views/repo_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ def create_ssh_key(self):
ssh_add_window = SSHAddWindow()
self._window = ssh_add_window # For tests
ssh_add_window.setParent(self, QtCore.Qt.WindowType.Sheet)
ssh_add_window.accepted.connect(self.init_ssh)
# ssh_add_window.rejected.connect(lambda: self.sshComboBox.setCurrentIndex(0))
ssh_add_window.rejected.connect(self.init_ssh)
ssh_add_window.open()

def ssh_copy_to_clipboard_action(self):
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
import vorta.borg.borg_job
from PyQt6 import QtCore
from PyQt6.QtWidgets import QMessageBox
from PyQt6.QtWidgets import QDialogButtonBox, QMessageBox
from vorta.keyring.abc import VortaKeyring
from vorta.store.models import ArchiveModel, EventLogModel, RepoModel

Expand Down Expand Up @@ -243,10 +243,10 @@ def test_ssh_copy_to_clipboard_action(qapp, qtbot, mocker, tmpdir):
key_tmpfile, pub_tmpfile = ssh_dir.join("id_rsa-test"), ssh_dir.join("id_rsa-test.pub") # noqa: F841
key_tmpfile_full = os.path.join(key_tmpfile.dirname, key_tmpfile.basename)
ssh_dialog.outputFileTextBox.setText(key_tmpfile_full)
ssh_dialog.generate_key()
qtbot.mouseClick(ssh_dialog.generateButton, QtCore.Qt.MouseButton.LeftButton)
qtbot.waitUntil(lambda: ssh_dialog.errors.text().startswith('New key was copied'), **pytest._wait_defaults)
assert len(ssh_dir.listdir()) == 2
assert tab.sshComboBox.count() > 1
cancel_button = ssh_dialog.buttonBox.button(QDialogButtonBox.StandardButton.Cancel)
qtbot.mouseClick(cancel_button, QtCore.Qt.MouseButton.LeftButton)

# no ssh key selected to copy
assert tab.sshComboBox.currentIndex() == 0
Expand Down

0 comments on commit 999732e

Please sign in to comment.