Skip to content

Commit

Permalink
Fix up linting and unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ntoll committed Feb 4, 2020
1 parent 200369c commit 88d2d4d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
from uuid import uuid4
from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal, QEvent, QTimer, QSize, pyqtBoundSignal, \
QObject, QPoint
from PyQt5.QtGui import QIcon, QPalette, QBrush, QColor, QFont, QLinearGradient, QKeySequence, QCursor
from PyQt5.QtGui import QIcon, QPalette, QBrush, QColor, QFont, QLinearGradient,\
QKeySequence, QCursor
from PyQt5.QtWidgets import QListWidget, QLabel, QWidget, QListWidgetItem, QHBoxLayout, \
QPushButton, QVBoxLayout, QLineEdit, QScrollArea, QDialog, QAction, QMenu, QMessageBox, \
QToolButton, QSizePolicy, QPlainTextEdit, QStatusBar, QGraphicsDropShadowEffect
Expand Down Expand Up @@ -2725,7 +2726,7 @@ def __init__(self, source: Source, controller: Controller) -> None:

# Ensure TAB order from text edit -> send button
self.setTabOrder(self.text_edit, self.send_button)

# Set cursor.
self.send_button.setCursor(QCursor(Qt.PointingHandCursor))

Expand Down
9 changes: 8 additions & 1 deletion tests/gui/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

from PyQt5.QtCore import Qt, QEvent
from PyQt5.QtGui import QFocusEvent, QMovie
from PyQt5.QtGui import QFocusEvent, QMovie, QCursor
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QMessageBox, QMainWindow, \
QLineEdit
from sqlalchemy.orm import scoped_session, sessionmaker
Expand Down Expand Up @@ -232,12 +232,19 @@ def test_SyncIcon__on_sync(mocker):
Sync icon becomes active when it receives the syncing sync signal.
'''
sync_icon = SyncIcon()
sync_icon.setCursor = mocker.MagicMock()

sync_icon._on_sync('syncing')

file_path = sync_icon.sync_animation.fileName()
filename = file_path[file_path.rfind('/') + 1:]
assert filename == 'sync_active.gif'
sync_icon.setCursor.assert_called_once_with(QCursor(Qt.WaitCursor))

sync_icon.setCursor.reset_mock()

sync_icon._on_sync("synced")
sync_icon.setCursor.assert_called_once_with(QCursor(Qt.PointingHandCursor))


def test_SyncIcon___on_sync_with_data_not_equal_to_syncing(mocker):
Expand Down

0 comments on commit 88d2d4d

Please sign in to comment.