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 31, 2023
1 parent 2f689df commit 700652c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 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
5 changes: 4 additions & 1 deletion tests/unit/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,10 @@ def test_ssh_copy_to_clipboard_action(qapp, qtbot, mocker, tmpdir):
ssh_dialog.outputFileTextBox.setText(key_tmpfile_full)
ssh_dialog.generate_key()
qtbot.waitUntil(lambda: ssh_dialog.errors.text().startswith('New key was copied'), **pytest._wait_defaults)
mock_expanduser = mocker.patch('os.path.expanduser', return_value=str(tmpdir))
tab.init_ssh()
assert len(ssh_dir.listdir()) == 2
assert tab.sshComboBox.count() > 1
assert tab.sshComboBox.count() == 2

# no ssh key selected to copy
assert tab.sshComboBox.currentIndex() == 0
Expand All @@ -255,6 +257,7 @@ def test_ssh_copy_to_clipboard_action(qapp, qtbot, mocker, tmpdir):
text.assert_called_with(message)

# Select a key and copy it
mock_expanduser.return_value = pub_tmpfile
tab.sshComboBox.setCurrentIndex(1)
assert tab.sshComboBox.currentIndex() == 1
qtbot.mouseClick(tab.sshKeyToClipboardButton, QtCore.Qt.MouseButton.LeftButton)
Expand Down

0 comments on commit 700652c

Please sign in to comment.