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:
Miguel Jacq 2021-05-04 16:21:42 +10:00
parent 659ed83853
commit 04019389da
No known key found for this signature in database
GPG key ID: EEA4341C6D97A0B6
10 changed files with 40 additions and 38 deletions

View file

@ -36,7 +36,6 @@ class TestOnionShare:
def test_init(self, onionshare_obj):
assert onionshare_obj.hidserv_dir is None
assert onionshare_obj.onion_host is None
assert onionshare_obj.cleanup_filenames == []
assert onionshare_obj.local_only is False
def test_start_onion_service(self, onionshare_obj, mode_settings_obj):
@ -48,11 +47,3 @@ class TestOnionShare:
onionshare_obj.local_only = True
onionshare_obj.start_onion_service("share", mode_settings_obj)
assert onionshare_obj.onion_host == "127.0.0.1:{}".format(onionshare_obj.port)
def test_cleanup(self, onionshare_obj, temp_dir_1024, temp_file_1024):
onionshare_obj.cleanup_filenames = [temp_dir_1024, temp_file_1024]
onionshare_obj.cleanup()
assert os.path.exists(temp_dir_1024) is False
assert os.path.exists(temp_dir_1024) is False
assert onionshare_obj.cleanup_filenames == []