Fix tests after refactoring Common

This commit is contained in:
Micah Lee 2018-03-13 02:22:26 -07:00
parent 50409167d4
commit c2fecf8aa4
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
7 changed files with 73 additions and 79 deletions

View file

@ -65,7 +65,8 @@ def temp_file_1024_delete():
@pytest.yield_fixture(scope='session')
def custom_zw():
zw = web.ZipWriter(
zip_filename=common.random_string(4, 6),
common.Common(),
zip_filename=common.Common.random_string(4, 6),
processed_size_callback=lambda _: 'custom_callback'
)
yield zw
@ -76,7 +77,7 @@ def custom_zw():
# pytest > 2.9 only needs @pytest.fixture
@pytest.yield_fixture(scope='session')
def default_zw():
zw = web.ZipWriter()
zw = web.ZipWriter(common.Common())
yield zw
zw.close()
tmp_dir = os.path.dirname(zw.zip_filename)
@ -118,16 +119,6 @@ def platform_windows(monkeypatch):
monkeypatch.setattr('platform.system', lambda: 'Windows')
@pytest.fixture
def set_debug_false(monkeypatch):
monkeypatch.setattr('onionshare.common.debug', False)
@pytest.fixture
def set_debug_true(monkeypatch):
monkeypatch.setattr('onionshare.common.debug', True)
@pytest.fixture
def sys_argv_sys_prefix(monkeypatch):
monkeypatch.setattr('sys.argv', [sys.prefix])
@ -157,3 +148,7 @@ def time_time_100(monkeypatch):
@pytest.fixture
def time_strftime(monkeypatch):
monkeypatch.setattr('time.strftime', lambda _: 'Jun 06 2013 11:05:00')
@pytest.fixture
def common_obj():
return common.Common()