mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-04 07:25:10 -04:00
Move the cleanup() function from Onionshare class to Web class, so that the list of files to be cleaned up is always available (needed for website temp files)
This commit is contained in:
parent
659ed83853
commit
04019389da
10 changed files with 40 additions and 38 deletions
|
@ -51,6 +51,7 @@ def web_obj(temp_dir, common_obj, mode, num_files=0):
|
|||
web.generate_password()
|
||||
web.running = True
|
||||
|
||||
web.cleanup_filenames == []
|
||||
web.app.testing = True
|
||||
|
||||
# Share mode
|
||||
|
@ -345,6 +346,16 @@ class TestWeb:
|
|||
res.get_data()
|
||||
assert res.status_code == 200
|
||||
|
||||
def test_cleanup(self, common_obj, temp_dir_1024, temp_file_1024):
|
||||
web = web_obj(temp_dir_1024, common_obj, "share", 3)
|
||||
|
||||
web.cleanup_filenames = [temp_dir_1024, temp_file_1024]
|
||||
web.cleanup()
|
||||
|
||||
assert os.path.exists(temp_file_1024) is False
|
||||
assert os.path.exists(temp_dir_1024) is False
|
||||
assert web.cleanup_filenames == []
|
||||
|
||||
def _make_auth_headers(self, password):
|
||||
auth = base64.b64encode(b"onionshare:" + password.encode()).decode()
|
||||
h = Headers()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue