Skip to content

Commit

Permalink
reformat using black
Browse files Browse the repository at this point in the history
  • Loading branch information
Allie Crevier committed Jun 22, 2022
1 parent 024917d commit a506fa5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 77 deletions.
5 changes: 1 addition & 4 deletions securedrop_client/api_jobs/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,7 @@ def _update_users(session: Session, remote_users: List[SDKUser]) -> None:
session.commit()


def _update_state(
app_state: state.State,
submissions: List,
) -> None:
def _update_state(app_state: state.State, submissions: List) -> None:
for submission in submissions:
if submission.is_file():
app_state.add_file(
Expand Down
5 changes: 1 addition & 4 deletions tests/api_jobs/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ def setUp(self):
self._submissions = []

def test_handles_missing_files_gracefully(self):
self._sources = [
Source(uuid="3"),
Source(uuid="4"),
]
self._sources = [Source(uuid="3"), Source(uuid="4")]
self._submissions = [
Submission(uuid="6", source_uuid="3", is_file=lambda: True, is_downloaded=True),
Submission(uuid="7", source_uuid="4", is_file=lambda: True, is_downloaded=True),
Expand Down
5 changes: 1 addition & 4 deletions tests/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,7 @@ def call_api(self, api_client, session):

def RemoteUser(**attrs):
defaults = dict(
uuid=str(uuid.uuid4()),
username="dellsberg",
first_name="Daniel",
last_name="Ellsberg",
uuid=str(uuid.uuid4()), username="dellsberg", first_name="Daniel", last_name="Ellsberg"
)
defaults.update(attrs)
return SDKUser(**defaults)
Expand Down
71 changes: 10 additions & 61 deletions tests/gui/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2547,14 +2547,7 @@ def test_SpeechBubble_init(mocker):
mock_download_error_connect = mocker.Mock()
mock_download_error_signal.connect = mock_download_error_connect

sb = SpeechBubble(
"mock id",
"hello",
mock_update_signal,
mock_download_error_signal,
0,
123,
)
sb = SpeechBubble("mock id", "hello", mock_update_signal, mock_download_error_signal, 0, 123)

sb.message.text() == "hello"

Expand Down Expand Up @@ -2597,12 +2590,7 @@ def test_SpeechBubble_adjust_width(mocker):
"""

sb = SpeechBubble(
"mock id",
"hello",
mocker.Mock(),
mocker.Mock(),
0,
SpeechBubble.MIN_CONTAINER_WIDTH,
"mock id", "hello", mocker.Mock(), mocker.Mock(), 0, SpeechBubble.MIN_CONTAINER_WIDTH
)

sb.adjust_width(sb.MIN_CONTAINER_WIDTH - 1)
Expand All @@ -2622,12 +2610,7 @@ def test_SpeechBubble_update_text(mocker):

msg_id = "abc123"
sb = SpeechBubble(
msg_id,
"hello",
mock_signal,
mock_signal,
0,
SpeechBubble.MIN_CONTAINER_WIDTH,
msg_id, "hello", mock_signal, mock_signal, 0, SpeechBubble.MIN_CONTAINER_WIDTH
)

new_msg = "new message"
Expand All @@ -2646,12 +2629,7 @@ def test_SpeechBubble_html_init(mocker):
"""
mock_signal = mocker.MagicMock()
bubble = SpeechBubble(
"mock id",
"<b>hello</b>",
mock_signal,
mock_signal,
0,
SpeechBubble.MIN_CONTAINER_WIDTH,
"mock id", "<b>hello</b>", mock_signal, mock_signal, 0, SpeechBubble.MIN_CONTAINER_WIDTH
)
assert bubble.message.text() == "<b>hello</b>"

Expand All @@ -2662,12 +2640,7 @@ def test_SpeechBubble_with_apostrophe_in_text(mocker):

message = "I'm sure, you are reading my message."
bubble = SpeechBubble(
"mock id",
message,
mock_signal,
mock_signal,
0,
SpeechBubble.MIN_CONTAINER_WIDTH,
"mock id", message, mock_signal, mock_signal, 0, SpeechBubble.MIN_CONTAINER_WIDTH
)
assert bubble.message.text() == message

Expand All @@ -2678,12 +2651,7 @@ def test_SpeechBubble__on_download_error(mocker):
message_uuid = "mock id"
message = "I'm sure, you are reading my message."
bubble = SpeechBubble(
message_uuid,
message,
mock_signal,
mock_signal,
0,
SpeechBubble.MIN_CONTAINER_WIDTH,
message_uuid, message, mock_signal, mock_signal, 0, SpeechBubble.MIN_CONTAINER_WIDTH
)
assert bubble.message.text() == message

Expand All @@ -2695,12 +2663,7 @@ def test_SpeechBubble__on_download_error(mocker):
def test_CheckMark_eventFilter_hover(mocker):
mock_signal = mocker.MagicMock()
bubble = SpeechBubble(
"mock id",
"<b>hello</b>",
mock_signal,
mock_signal,
0,
SpeechBubble.MIN_CONTAINER_WIDTH,
"mock id", "<b>hello</b>", mock_signal, mock_signal, 0, SpeechBubble.MIN_CONTAINER_WIDTH
)

bubble.check_mark = mocker.MagicMock()
Expand Down Expand Up @@ -2729,14 +2692,7 @@ def test_SpeechBubble_on_update_authenticated_user(mocker):

authenticated_user = factory.User()

sb = SpeechBubble(
"mock id",
"hello",
mock_update_signal,
mock_download_error_signal,
0,
123,
)
sb = SpeechBubble("mock id", "hello", mock_update_signal, mock_download_error_signal, 0, 123)

sb.on_update_authenticated_user(authenticated_user)
assert sb.authenticated_user == authenticated_user
Expand All @@ -2750,14 +2706,7 @@ def test_MessageWidget_init(mocker):
mock_connected = mocker.Mock()
mock_signal.connect = mock_connected

MessageWidget(
"abc123",
"hello",
mock_signal,
mock_signal,
0,
123,
)
MessageWidget("abc123", "hello", mock_signal, mock_signal, 0, 123)

assert mock_connected.called

Expand Down Expand Up @@ -3909,7 +3858,7 @@ def test_ConversationView_ConversationScrollArea_resize(mocker):
file_widget_adjust_width = mocker.patch("securedrop_client.gui.widgets.FileWidget.adjust_width")

cv.setFixedWidth(800)
event = QResizeEvent(cv.scroll.size(), QSize(123456789, 123456789))
event = QResizeEvent(cv.scroll.size(), QSize(123_456_789, 123_456_789))
cv.scroll.resizeEvent(event)

assert cv.scroll.widget().width() == cv.scroll.width()
Expand Down
5 changes: 1 addition & 4 deletions tests/test_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,10 +1215,7 @@ def test_Controller_download_conversation(homedir, config, session, mocker, sess

co.download_conversation(conversation_id)

expected = [
call(some_file_id, co.data_dir, co.gpg),
call(another_file_id, co.data_dir, co.gpg),
]
expected = [call(some_file_id, co.data_dir, co.gpg), call(another_file_id, co.data_dir, co.gpg)]
assert file_download_job_constructor.mock_calls == expected

assert len(add_job_emissions) == 2
Expand Down

0 comments on commit a506fa5

Please sign in to comment.