mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-10 11:47:27 -03:00
Fix stealth test, add legacy v2 onion test
This commit is contained in:
parent
fea34c0f34
commit
dbbc9c0c82
4 changed files with 34 additions and 5 deletions
|
@ -158,9 +158,7 @@ class TorGuiBaseTest(GuiBaseTest):
|
|||
def copy_have_hidserv_auth_button(self, mode):
|
||||
'''Test that the Copy HidservAuth button is shown'''
|
||||
self.assertTrue(mode.server_status.copy_hidservauth_button.isVisible())
|
||||
clipboard = self.gui.qtapp.clipboard()
|
||||
self.assertRegex(clipboard.text(), r'HidServAuth %s [a-zA-Z1-9]' % self.gui.app.onion_host)
|
||||
|
||||
def hidserv_auth_string(self):
|
||||
'''Test the validity of the HidservAuth string'''
|
||||
self.assertRegex(self.gui.app.auth_string, r'HidServAuth %s [a-zA-Z1-9]' % self.gui.app.onion_host)
|
||||
self.assertRegex(self.gui.app.auth_string, r'HidServAuth {} [a-zA-Z1-9]'.format(self.gui.app.onion_host))
|
||||
|
|
|
@ -36,11 +36,16 @@ class TorGuiShareTest(TorGuiBaseTest, GuiShareTest):
|
|||
'''Test that we have the same onion'''
|
||||
self.assertEqual(self.gui.app.onion_host, onion)
|
||||
|
||||
# legacy v2 onion test
|
||||
def have_v2_onion(self):
|
||||
'''Test that the onion is a v2 style onion'''
|
||||
self.assertRegex(self.gui.app.onion_host, r'[a-z2-7].onion')
|
||||
self.assertEqual(len(self.gui.app.onion_host), 22)
|
||||
|
||||
# 'Grouped' tests follow from here
|
||||
|
||||
def run_all_share_mode_started_tests(self, public_mode):
|
||||
"""Tests in share mode after starting a share"""
|
||||
'''Tests in share mode after starting a share'''
|
||||
self.server_working_on_start_button_pressed(self.gui.share_mode)
|
||||
self.server_status_indicator_says_starting(self.gui.share_mode)
|
||||
self.add_delete_buttons_hidden()
|
||||
|
|
|
@ -22,8 +22,8 @@ class ShareModeStealthTest(unittest.TestCase, TorGuiShareTest):
|
|||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_setup_tests()
|
||||
self.run_all_share_mode_started_tests(False)
|
||||
self.copy_have_hidserv_auth_button(self.gui.share_mode)
|
||||
self.hidserv_auth_string()
|
||||
self.copy_have_hidserv_auth_button(self.gui.share_mode)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
26
tests/onionshare_share_mode_v2_onion_test.py
Normal file
26
tests/onionshare_share_mode_v2_onion_test.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .TorGuiShareTest import TorGuiShareTest
|
||||
|
||||
class ShareModeV2OnionTest(unittest.TestCase, TorGuiShareTest):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
test_settings = {
|
||||
"use_legacy_v2_onions": True,
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeV2OnionTest')
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
TorGuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_tests(False, False)
|
||||
self.have_v2_onion()
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Loading…
Reference in a new issue