mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-27 00:09:50 -05:00
Write settings json files out to unique files per test
This commit is contained in:
parent
fe091db596
commit
6227c58796
@ -19,7 +19,7 @@ from onionshare_gui.mode.receive_mode import ReceiveMode
|
|||||||
|
|
||||||
class GuiBaseTest(object):
|
class GuiBaseTest(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def set_up(test_settings):
|
def set_up(test_settings, settings_filename):
|
||||||
'''Create GUI with given settings'''
|
'''Create GUI with given settings'''
|
||||||
# Create our test file
|
# Create our test file
|
||||||
testfile = open('/tmp/test.txt', 'w')
|
testfile = open('/tmp/test.txt', 'w')
|
||||||
@ -44,8 +44,7 @@ class GuiBaseTest(object):
|
|||||||
app = OnionShare(common, testonion, True, 0)
|
app = OnionShare(common, testonion, True, 0)
|
||||||
|
|
||||||
web = Web(common, False, True)
|
web = Web(common, False, True)
|
||||||
settings_filename = '/tmp/testsettings.json'
|
open('/tmp/{}.json'.format(settings_filename), 'w').write(json.dumps(test_settings))
|
||||||
open(settings_filename, 'w').write(json.dumps(test_settings))
|
|
||||||
|
|
||||||
gui = OnionShareGui(common, testonion, qtapp, app, ['/tmp/test.txt'], settings_filename, True)
|
gui = OnionShareGui(common, testonion, qtapp, app, ['/tmp/test.txt'], settings_filename, True)
|
||||||
return gui
|
return gui
|
||||||
@ -54,6 +53,7 @@ class GuiBaseTest(object):
|
|||||||
def tear_down():
|
def tear_down():
|
||||||
try:
|
try:
|
||||||
os.remove('/tmp/test.txt')
|
os.remove('/tmp/test.txt')
|
||||||
|
os.remove('/tmp/download.zip')
|
||||||
shutil.rmtree('/tmp/OnionShare')
|
shutil.rmtree('/tmp/OnionShare')
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -11,7 +11,7 @@ class ReceiveModePublicModeTest(unittest.TestCase, GuiReceiveTest):
|
|||||||
"public_mode": True,
|
"public_mode": True,
|
||||||
"receive_allow_receiver_shutdown": True
|
"receive_allow_receiver_shutdown": True
|
||||||
}
|
}
|
||||||
cls.gui = GuiReceiveTest.set_up(test_settings)
|
cls.gui = GuiReceiveTest.set_up(test_settings, 'ReceiveModePublicModeTest')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -10,7 +10,7 @@ class ReceiveModeTest(unittest.TestCase, GuiReceiveTest):
|
|||||||
test_settings = {
|
test_settings = {
|
||||||
"receive_allow_receiver_shutdown": True
|
"receive_allow_receiver_shutdown": True
|
||||||
}
|
}
|
||||||
cls.gui = GuiReceiveTest.set_up(test_settings)
|
cls.gui = GuiReceiveTest.set_up(test_settings, 'ReceiveModeTest')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -10,7 +10,7 @@ class ShareModePublicModeTest(unittest.TestCase, GuiShareTest):
|
|||||||
test_settings = {
|
test_settings = {
|
||||||
"public_mode": True,
|
"public_mode": True,
|
||||||
}
|
}
|
||||||
cls.gui = GuiShareTest.set_up(test_settings)
|
cls.gui = GuiShareTest.set_up(test_settings, 'ShareModePublicModeTest')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -10,7 +10,7 @@ class ShareModeStayOpenTest(unittest.TestCase, GuiShareTest):
|
|||||||
test_settings = {
|
test_settings = {
|
||||||
"close_after_first_download": False,
|
"close_after_first_download": False,
|
||||||
}
|
}
|
||||||
cls.gui = GuiShareTest.set_up(test_settings)
|
cls.gui = GuiShareTest.set_up(test_settings, 'ShareModeStayOpenTest')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -9,7 +9,7 @@ class ShareModeTest(unittest.TestCase, GuiShareTest):
|
|||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
test_settings = {
|
test_settings = {
|
||||||
}
|
}
|
||||||
cls.gui = GuiShareTest.set_up(test_settings)
|
cls.gui = GuiShareTest.set_up(test_settings, 'ShareModeTest')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -13,7 +13,7 @@ class ShareModePersistentSlugTest(unittest.TestCase, GuiShareTest):
|
|||||||
"save_private_key": True,
|
"save_private_key": True,
|
||||||
"close_after_first_download": False,
|
"close_after_first_download": False,
|
||||||
}
|
}
|
||||||
cls.gui = GuiShareTest.set_up(test_settings)
|
cls.gui = GuiShareTest.set_up(test_settings, 'ShareModePersistentSlugTest')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
@ -11,7 +11,7 @@ class ShareModeTimerTest(unittest.TestCase, GuiShareTest):
|
|||||||
"public_mode": False,
|
"public_mode": False,
|
||||||
"shutdown_timeout": True,
|
"shutdown_timeout": True,
|
||||||
}
|
}
|
||||||
cls.gui = GuiShareTest.set_up(test_settings)
|
cls.gui = GuiShareTest.set_up(test_settings, 'ShareModeTimerTest')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
|
Loading…
Reference in New Issue
Block a user