2018-09-22 03:47:38 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import unittest
|
|
|
|
import pytest
|
|
|
|
import json
|
|
|
|
|
2018-09-23 20:41:48 -04:00
|
|
|
from PyQt5 import QtWidgets
|
2018-09-22 03:47:38 -04:00
|
|
|
|
|
|
|
from onionshare.common import Common
|
|
|
|
from onionshare.web import Web
|
|
|
|
from onionshare import onion, strings
|
|
|
|
from onionshare_gui import *
|
|
|
|
|
2018-10-11 00:09:27 -04:00
|
|
|
from .GuiBaseTest import GuiBaseTest
|
2018-09-23 20:41:48 -04:00
|
|
|
|
2018-10-11 00:09:27 -04:00
|
|
|
class ShareModePersistentSlugTest(unittest.TestCase):
|
2018-09-22 03:47:38 -04:00
|
|
|
@classmethod
|
|
|
|
def setUpClass(cls):
|
|
|
|
test_settings = {
|
|
|
|
"public_mode": False,
|
|
|
|
"slug": "",
|
2018-10-11 00:09:27 -04:00
|
|
|
"save_private_key": True,
|
|
|
|
"close_after_first_download": False,
|
2018-09-22 03:47:38 -04:00
|
|
|
}
|
2018-10-11 01:07:16 -04:00
|
|
|
cls.gui = GuiBaseTest.set_up(test_settings)
|
2018-09-22 03:47:38 -04:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def tearDownClass(cls):
|
2018-10-11 00:09:27 -04:00
|
|
|
GuiBaseTest.tear_down()
|
2018-09-22 03:47:38 -04:00
|
|
|
|
2018-10-11 01:07:16 -04:00
|
|
|
@pytest.mark.run(order=1)
|
2018-10-11 00:09:27 -04:00
|
|
|
def test_run_all_common_setup_tests(self):
|
|
|
|
GuiBaseTest.run_all_common_setup_tests(self)
|
2018-09-22 03:47:38 -04:00
|
|
|
|
2018-10-11 01:07:16 -04:00
|
|
|
@pytest.mark.run(order=2)
|
|
|
|
def test_run_all_share_mode_tests(self):
|
2018-10-11 00:09:27 -04:00
|
|
|
GuiBaseTest.run_all_share_mode_tests(self, False, True)
|
2018-09-22 03:47:38 -04:00
|
|
|
global slug
|
|
|
|
slug = self.gui.share_mode.server_status.web.slug
|
|
|
|
|
2018-10-11 01:07:16 -04:00
|
|
|
@pytest.mark.run(order=3)
|
2018-09-22 03:47:38 -04:00
|
|
|
def test_have_same_slug(self):
|
|
|
|
'''Test that we have the same slug'''
|
|
|
|
self.assertEqual(self.gui.share_mode.server_status.web.slug, slug)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|