mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Remove unique settings file per test, because they don't run concurrently anymore
This commit is contained in:
parent
0176535e50
commit
b749fc8d12
@ -19,7 +19,7 @@ from onionshare_gui.mode.receive_mode import ReceiveMode
|
||||
|
||||
class GuiBaseTest(object):
|
||||
@staticmethod
|
||||
def set_up(test_settings, settings_filename):
|
||||
def set_up(test_settings):
|
||||
'''Create GUI with given settings'''
|
||||
# Create our test file
|
||||
testfile = open('/tmp/test.txt', 'w')
|
||||
@ -51,9 +51,9 @@ class GuiBaseTest(object):
|
||||
app = OnionShare(common, testonion, True, 0)
|
||||
|
||||
web = Web(common, False, True)
|
||||
open('/tmp/{}.json'.format(settings_filename), 'w').write(json.dumps(test_settings))
|
||||
open('/tmp/settings.json', 'w').write(json.dumps(test_settings))
|
||||
|
||||
gui = OnionShareGui(common, testonion, qtapp, app, ['/tmp/test.txt', '/tmp/testdir'], '/tmp/{}.json'.format(settings_filename), True)
|
||||
gui = OnionShareGui(common, testonion, qtapp, app, ['/tmp/test.txt', '/tmp/testdir'], '/tmp/settings.json', True)
|
||||
return gui
|
||||
|
||||
@staticmethod
|
||||
@ -61,6 +61,7 @@ class GuiBaseTest(object):
|
||||
'''Clean up after tests'''
|
||||
try:
|
||||
os.remove('/tmp/test.txt')
|
||||
os.remove('/tmp/settings.json')
|
||||
os.remove('/tmp/largefile')
|
||||
shutil.rmtree('/tmp/OnionShare')
|
||||
shutil.rmtree('/tmp/testdir')
|
||||
|
@ -13,7 +13,7 @@ from onionshare_gui.settings_dialog import SettingsDialog
|
||||
|
||||
class SettingsGuiBaseTest(object):
|
||||
@staticmethod
|
||||
def set_up(test_settings, settings_filename):
|
||||
def set_up(test_settings):
|
||||
'''Create the GUI'''
|
||||
# Create our test file
|
||||
testfile = open('/tmp/test.txt', 'w')
|
||||
@ -37,9 +37,9 @@ class SettingsGuiBaseTest(object):
|
||||
if key not in test_settings:
|
||||
test_settings[key] = val
|
||||
|
||||
open('/tmp/{}.json'.format(settings_filename), 'w').write(json.dumps(test_settings))
|
||||
open('/tmp/settings.json', 'w').write(json.dumps(test_settings))
|
||||
|
||||
gui = SettingsDialog(common, testonion, qtapp, '/tmp/{}.json'.format(settings_filename), True)
|
||||
gui = SettingsDialog(common, testonion, qtapp, '/tmp/settings.json', True)
|
||||
return gui
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ from .GuiBaseTest import GuiBaseTest
|
||||
|
||||
class TorGuiBaseTest(GuiBaseTest):
|
||||
@staticmethod
|
||||
def set_up(test_settings, settings_filename):
|
||||
def set_up(test_settings):
|
||||
'''Create GUI with given settings'''
|
||||
# Create our test file
|
||||
testfile = open('/tmp/test.txt', 'w')
|
||||
@ -51,9 +51,9 @@ class TorGuiBaseTest(GuiBaseTest):
|
||||
app = OnionShare(common, testonion, False, 0)
|
||||
|
||||
web = Web(common, False, False)
|
||||
open('/tmp/{}.json'.format(settings_filename), 'w').write(json.dumps(test_settings))
|
||||
open('/tmp/settings.json', 'w').write(json.dumps(test_settings))
|
||||
|
||||
gui = OnionShareGui(common, testonion, qtapp, app, ['/tmp/test.txt', '/tmp/testdir'], '/tmp/{}.json'.format(settings_filename), False)
|
||||
gui = OnionShareGui(common, testonion, qtapp, app, ['/tmp/test.txt', '/tmp/testdir'], '/tmp/settings.json', False)
|
||||
return gui
|
||||
|
||||
def history_indicator(self, mode, public_mode):
|
||||
|
@ -10,7 +10,7 @@ class Local404PublicModeRateLimitTest(unittest.TestCase, GuiShareTest):
|
||||
"close_after_first_download": False,
|
||||
"public_mode": True
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'Local404PublicModeRateLimitTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -9,7 +9,7 @@ class Local404RateLimitTest(unittest.TestCase, GuiShareTest):
|
||||
test_settings = {
|
||||
"close_after_first_download": False
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'Local404RateLimitTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -9,7 +9,7 @@ class LocalOpenSettingsDialogTest(unittest.TestCase, GuiShareTest):
|
||||
def setUpClass(cls):
|
||||
test_settings = {
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'LocalOpenSettingsDialogTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -10,7 +10,7 @@ class LocalQuittingDuringSharePromptsWarningTest(unittest.TestCase, GuiShareTest
|
||||
test_settings = {
|
||||
"close_after_first_download": False
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'LocalQuittingDuringSharePromptsWarningTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -9,7 +9,7 @@ class LocalReceiveModeSenderClosedTest(unittest.TestCase, GuiReceiveTest):
|
||||
test_settings = {
|
||||
"receive_allow_receiver_shutdown": True
|
||||
}
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModeSenderClosedTest')
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -10,7 +10,7 @@ class LocalReceiveModeTimerTest(unittest.TestCase, GuiReceiveTest):
|
||||
"public_mode": False,
|
||||
"shutdown_timeout": True,
|
||||
}
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModeTimerTest')
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -9,7 +9,7 @@ class LocalReceiveModeUnwritableTest(unittest.TestCase, GuiReceiveTest):
|
||||
test_settings = {
|
||||
"receive_allow_receiver_shutdown": True
|
||||
}
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModeUnwritableTest')
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -10,7 +10,7 @@ class LocalReceivePublicModeUnwritableTest(unittest.TestCase, GuiReceiveTest):
|
||||
"public_mode": True,
|
||||
"receive_allow_receiver_shutdown": True
|
||||
}
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceivePublicModeUnwritableTest')
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
@ -10,7 +10,7 @@ class LocalReceiveModePublicModeTest(unittest.TestCase, GuiReceiveTest):
|
||||
"public_mode": True,
|
||||
"receive_allow_receiver_shutdown": True
|
||||
}
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModePublicModeTest')
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -9,7 +9,7 @@ class LocalReceiveModeTest(unittest.TestCase, GuiReceiveTest):
|
||||
test_settings = {
|
||||
"receive_allow_receiver_shutdown": True
|
||||
}
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModeTest')
|
||||
cls.gui = GuiReceiveTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -13,7 +13,7 @@ class SettingsGuiTest(unittest.TestCase, SettingsGuiBaseTest):
|
||||
"no_bridges": False,
|
||||
"tor_bridges_use_custom_bridges": "Bridge 1.2.3.4:56 EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\nBridge 5.6.7.8:910 EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\nBridge 11.12.13.14:1516 EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n",
|
||||
}
|
||||
cls.gui = SettingsGuiBaseTest.set_up(test_settings, 'settings')
|
||||
cls.gui = SettingsGuiBaseTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -9,7 +9,7 @@ class LocalShareModePublicModeTest(unittest.TestCase, GuiShareTest):
|
||||
test_settings = {
|
||||
"public_mode": True,
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModePublicModeTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -9,7 +9,7 @@ class LocalShareModeStayOpenTest(unittest.TestCase, GuiShareTest):
|
||||
test_settings = {
|
||||
"close_after_first_download": False,
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeStayOpenTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -8,7 +8,7 @@ class LocalShareModeTest(unittest.TestCase, GuiShareTest):
|
||||
def setUpClass(cls):
|
||||
test_settings = {
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -8,7 +8,7 @@ class LocalShareModeLargeDownloadTest(unittest.TestCase, GuiShareTest):
|
||||
def setUpClass(cls):
|
||||
test_settings = {
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeLargeDownloadTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -12,7 +12,7 @@ class LocalShareModePersistentSlugTest(unittest.TestCase, GuiShareTest):
|
||||
"save_private_key": True,
|
||||
"close_after_first_download": False,
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModePersistentSlugTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -10,7 +10,7 @@ class LocalShareModeTimerTest(unittest.TestCase, GuiShareTest):
|
||||
"public_mode": False,
|
||||
"shutdown_timeout": True,
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeTimerTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -11,7 +11,7 @@ class LocalShareModeTimerTooShortTest(unittest.TestCase, GuiShareTest):
|
||||
"public_mode": False,
|
||||
"shutdown_timeout": True,
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeTimerTooShortTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -8,7 +8,7 @@ class LocalShareModeUnReadableFileTest(unittest.TestCase, GuiShareTest):
|
||||
def setUpClass(cls):
|
||||
test_settings = {
|
||||
}
|
||||
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeUnReadableFileTest')
|
||||
cls.gui = GuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -11,7 +11,7 @@ class ShareModeCancelSecondShareTest(unittest.TestCase, TorGuiShareTest):
|
||||
test_settings = {
|
||||
"close_after_first_download": True
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeCancelSecondShareTest')
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -11,7 +11,7 @@ class ReceiveModeTest(unittest.TestCase, TorGuiReceiveTest):
|
||||
"public_mode": True,
|
||||
"receive_allow_receiver_shutdown": True
|
||||
}
|
||||
cls.gui = TorGuiReceiveTest.set_up(test_settings, 'ReceiveModeTest')
|
||||
cls.gui = TorGuiReceiveTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -10,7 +10,7 @@ class ReceiveModeTest(unittest.TestCase, TorGuiReceiveTest):
|
||||
test_settings = {
|
||||
"receive_allow_receiver_shutdown": True
|
||||
}
|
||||
cls.gui = TorGuiReceiveTest.set_up(test_settings, 'ReceiveModeTest')
|
||||
cls.gui = TorGuiReceiveTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -9,7 +9,7 @@ class ShareModeCancelTest(unittest.TestCase, TorGuiShareTest):
|
||||
def setUpClass(cls):
|
||||
test_settings = {
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeCancelTest')
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -10,7 +10,7 @@ class ShareModePublicModeTest(unittest.TestCase, TorGuiShareTest):
|
||||
test_settings = {
|
||||
"public_mode": True,
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModePublicModeTest')
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -10,7 +10,7 @@ class ShareModeStayOpenTest(unittest.TestCase, TorGuiShareTest):
|
||||
test_settings = {
|
||||
"close_after_first_download": False,
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeStayOpenTest')
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -9,7 +9,7 @@ class ShareModeTest(unittest.TestCase, TorGuiShareTest):
|
||||
def setUpClass(cls):
|
||||
test_settings = {
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeTest')
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -14,7 +14,7 @@ class ShareModePersistentSlugTest(unittest.TestCase, TorGuiShareTest):
|
||||
"save_private_key": True,
|
||||
"close_after_first_download": False,
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModePersistentSlugTest')
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -11,7 +11,7 @@ class ShareModeStealthTest(unittest.TestCase, TorGuiShareTest):
|
||||
"use_legacy_v2_onions": True,
|
||||
"use_stealth": True,
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeStealthTest')
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -11,7 +11,7 @@ class ShareModeTimerTest(unittest.TestCase, TorGuiShareTest):
|
||||
"public_mode": False,
|
||||
"shutdown_timeout": True,
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeTimerTest')
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
@ -9,7 +9,7 @@ class ShareModeTorConnectionKilledTest(unittest.TestCase, TorGuiShareTest):
|
||||
def setUpClass(cls):
|
||||
test_settings = {
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeTorConnectionKilledTest')
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
|
@ -10,7 +10,7 @@ class ShareModeV2OnionTest(unittest.TestCase, TorGuiShareTest):
|
||||
test_settings = {
|
||||
"use_legacy_v2_onions": True,
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeV2OnionTest')
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
Loading…
Reference in New Issue
Block a user