Exemplo n.º 1
0
def custom_zw():
    zw = web.share_mode.ZipWriter(
        common.Common(),
        zip_filename=common.Common.random_string(4, 6),
        processed_size_callback=lambda _: "custom_callback",
    )
    yield zw
    zw.close()
    os.remove(zw.zip_filename)
Exemplo n.º 2
0
def default_zw():
    zw = web.share_mode.ZipWriter(common.Common())
    yield zw
    zw.close()
    tmp_dir = os.path.dirname(zw.zip_filename)
    try:
        shutil.rmtree(tmp_dir, ignore_errors=True)
    except:
        pass
Exemplo n.º 3
0
def settings_obj(sys_onionshare_dev_mode, platform_linux):
    _common = common.Common()
    _common.version = 'DUMMY_VERSION_1.2.3'
    return settings.Settings(_common)
Exemplo n.º 4
0
 def test_filename_windows(self, monkeypatch, platform_windows):
     monkeypatch.setenv('APPDATA', 'C:')
     obj = settings.Settings(common.Common())
     assert obj.filename.replace('/',
                                 '\\') == 'C:\\OnionShare\\onionshare.json'
Exemplo n.º 5
0
 def test_filename_linux(self, monkeypatch, os_path_expanduser,
                         platform_linux):
     obj = settings.Settings(common.Common())
     assert obj.filename == '~/.config/onionshare/onionshare.json'
Exemplo n.º 6
0
 def test_filename_darwin(self, monkeypatch, os_path_expanduser,
                          platform_darwin):
     obj = settings.Settings(common.Common())
     assert (obj.filename ==
             '~/Library/Application Support/OnionShare/onionshare.json')
Exemplo n.º 7
0
 def test_filename_windows(self, monkeypatch, platform_windows):
     obj = settings.Settings(common.Common())
     assert obj.filename == os.path.expanduser(
         "~\\AppData\\Roaming\\OnionShare-testdata\\onionshare.json")
Exemplo n.º 8
0
 def test_filename_linux(self, monkeypatch, platform_linux):
     obj = settings.Settings(common.Common())
     assert obj.filename == os.path.expanduser(
         "~/.config/onionshare-testdata/onionshare.json")
Exemplo n.º 9
0
 def test_filename_darwin(self, monkeypatch, platform_darwin):
     obj = settings.Settings(common.Common())
     assert obj.filename == os.path.expanduser(
         "~/Library/Application Support/OnionShare-testdata/onionshare.json"
     )
Exemplo n.º 10
0
def common_obj():
    return common.Common()
Exemplo n.º 11
0
def default_zw():
    zw = web.share_mode.ZipWriter(common.Common())
    yield zw
    zw.close()
    tmp_dir = os.path.dirname(zw.zip_filename)
    shutil.rmtree(tmp_dir)
 def test_filename_windows(self, monkeypatch, platform_windows):
     monkeypatch.setenv("APPDATA", "C:")
     obj = settings.Settings(common.Common())
     assert obj.filename.replace("/",
                                 "\\") == "C:\\OnionShare\\onionshare.json"