-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates the filesize after download and decryption #969
Conversation
hey can you elaborate on what you need help on regarding the unit testing? |
I just could not figure out a way to write the test. I I know I can write a functional test, but, not a unit test. |
a5a335f
to
062405e
Compare
(removing draft status in case I'm the only one that can) |
securedrop_client/gui/widgets.py
Outdated
@@ -2244,6 +2244,9 @@ def __init__( | |||
file_ready_signal.connect(self._on_file_downloaded, type=Qt.QueuedConnection) | |||
file_missing.connect(self._on_file_missing, type=Qt.QueuedConnection) | |||
|
|||
def update_file_size(self): | |||
self.file_size.setText(humanize_filesize(self.file.size)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could cause a crash if the file was deleted, I believe, so we can either add it to our ticket tracking possible crashers or temporary add a try catch for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually we should do both - add the try-catch and add it to the list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried adding a test that created the FileWidget
, then deleted its File
, then called update_file_size
and it did not crash. I've added the try/except block and a test with a mock to force an exception, just in case.
Fixes #917 This still needs unit test case.
I can't get this method to fail even if the FileWidget's file has been deleted, but just in case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
followed the steps in #917 and file shows up as 1MB
lgtm!
Description
Fixes #917
This still needs unit test case. I need help with that
Test Plan
Follow the steps from #917
Checklist
If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:
If these changes add or remove files other than client code, packaging logic (e.g., the AppArmor profile) may need to be updated. Please check as applicable: