mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-07 17:05:16 -04:00
Fix tests after refactoring Common
This commit is contained in:
parent
50409167d4
commit
c2fecf8aa4
7 changed files with 73 additions and 79 deletions
|
@ -26,19 +26,16 @@ import pytest
|
|||
from onionshare import common, settings, strings
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def custom_version(monkeypatch):
|
||||
monkeypatch.setattr(common, 'version', 'DUMMY_VERSION_1.2.3')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def os_path_expanduser(monkeypatch):
|
||||
monkeypatch.setattr('os.path.expanduser', lambda path: path)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def settings_obj(custom_version, sys_onionshare_dev_mode, platform_linux):
|
||||
return settings.Settings()
|
||||
def settings_obj(sys_onionshare_dev_mode, platform_linux):
|
||||
_common = common.Common()
|
||||
_common.version = 'DUMMY_VERSION_1.2.3'
|
||||
return settings.Settings(_common)
|
||||
|
||||
|
||||
class TestSettings:
|
||||
|
@ -154,30 +151,27 @@ class TestSettings:
|
|||
|
||||
def test_filename_darwin(
|
||||
self,
|
||||
custom_version,
|
||||
monkeypatch,
|
||||
os_path_expanduser,
|
||||
platform_darwin):
|
||||
obj = settings.Settings()
|
||||
obj = settings.Settings(common.Common())
|
||||
assert (obj.filename ==
|
||||
'~/Library/Application Support/OnionShare/onionshare.json')
|
||||
|
||||
def test_filename_linux(
|
||||
self,
|
||||
custom_version,
|
||||
monkeypatch,
|
||||
os_path_expanduser,
|
||||
platform_linux):
|
||||
obj = settings.Settings()
|
||||
obj = settings.Settings(common.Common())
|
||||
assert obj.filename == '~/.config/onionshare/onionshare.json'
|
||||
|
||||
def test_filename_windows(
|
||||
self,
|
||||
custom_version,
|
||||
monkeypatch,
|
||||
platform_windows):
|
||||
monkeypatch.setenv('APPDATA', 'C:')
|
||||
obj = settings.Settings()
|
||||
obj = settings.Settings(common.Common())
|
||||
assert obj.filename == 'C:\\OnionShare\\onionshare.json'
|
||||
|
||||
def test_set_custom_bridge(self, settings_obj):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue