Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rmol committed Apr 24, 2020
1 parent 236e8f6 commit 742c53f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
12 changes: 5 additions & 7 deletions securedrop_client/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,13 @@ def location(self, data_dir: str) -> str:

class DownloadErrorCodes(Enum):
"""
Enumerated download failure modes, with explanation templates as values.
Enumerated download failure modes, with templates as values.
The explanation templates are intended to be formatted with the
class name of a downloadable item.
The templates are intended to be formatted with the class name of
a downloadable item.
"""
CHECKSUM_ERROR = "Downloaded {object_type} was incomplete; it will be retried."
DECRYPTION_ERROR = (
"Downloaded {object_type} could not be decrypted. Administrator action is needed."
)
CHECKSUM_ERROR = "cannot download {object_type}"
DECRYPTION_ERROR = "cannot decrypt {object_type}"


class DownloadError(Base):
Expand Down
10 changes: 9 additions & 1 deletion securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1896,6 +1896,8 @@ class SpeechBubble(QWidget):
background-color: #fff;
""",
"message": """
min-width: 520px;
max-width: 520px;
font-family: 'Source Sans Pro';
font-weight: 400;
font-size: 15px;
Expand All @@ -1917,6 +1919,8 @@ class SpeechBubble(QWidget):
background-color: #fff;
""",
"message": """
min-width: 520px;
max-width: 520px;
font-family: 'Source Sans Pro';
font-weight: 400;
font-size: 15px;
Expand Down Expand Up @@ -2001,7 +2005,7 @@ def _update_text(self, source_id: str, message_uuid: str, text: str) -> None:
"""
if message_uuid == self.uuid:
self.message.setText(text)
self.set_normal_styles()
self.set_normal_styles()

@pyqtSlot(str, str, str)
def set_error(self, source_uuid: str, uuid: str, text: str):
Expand Down Expand Up @@ -2046,6 +2050,8 @@ class ReplyWidget(SpeechBubble):
border: 0px;
""",
"message": """
min-width: 520px;
max-width: 520px;
font-family: 'Source Sans Pro';
font-weight: 400;
font-size: 15px;
Expand Down Expand Up @@ -2075,6 +2081,8 @@ class ReplyWidget(SpeechBubble):
border: 0px;
""",
"message": """
min-width: 520px;
max-width: 520px;
font-family: 'Source Sans Pro';
font-weight: 400;
font-size: 15px;
Expand Down
10 changes: 3 additions & 7 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def test_file_with_download_error(session, download_error_codes):
session.commit()

classname = f.__class__.__name__.lower()
assert str(f) == f"Downloaded {classname} was incomplete; it will be retried."
assert str(f) == f"cannot download {classname}"


def test_message_with_download_error(session, download_error_codes):
Expand All @@ -269,9 +269,7 @@ def test_message_with_download_error(session, download_error_codes):
session.commit()

classname = m.__class__.__name__.lower()
assert str(m) == (
f"Downloaded {classname} could not be decrypted. Administrator action is needed."
)
assert str(m) == f"cannot decrypt {classname}"


def test_reply_with_download_error(session, download_error_codes):
Expand All @@ -283,6 +281,4 @@ def test_reply_with_download_error(session, download_error_codes):
session.commit()

classname = r.__class__.__name__.lower()
assert str(r) == (
f"Downloaded {classname} could not be decrypted. Administrator action is needed."
)
assert str(r) == f"cannot decrypt {classname}"

0 comments on commit 742c53f

Please sign in to comment.