1.0.5 - opisy usług w przekierowaniach
Wydanie WGTools-Extended / release (push) Successful in 11s

This commit is contained in:
asminme committed 2026-10-30 13:15:39 +01:00
1 parent 6e7eaa9282
commit f4929c7cac
12 files changed
+155 -16

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ class HelpTranslationTests(unittest.TestCase):
def test_unknown_language_defaults_to_english(self):
self.assertEqual(get_help_sections('non-existent-language'), HELP['en'])
def test_version(self):
self.assertEqual((ROOT/'VERSION').read_text().strip(),'1.0.4')
self.assertEqual((ROOT/'VERSION').read_text().strip(),'1.0.5')
if __name__ == '__main__':
unittest.main()
+1 -1
View File
@@ -15,7 +15,7 @@ LANGS = ('en', 'ru', 'de', 'fr', 'it', 'es', 'pl')
class CandidateTests(unittest.TestCase):
def test_versions_and_locale_fallback_contract(self):
self.assertEqual((ROOT / 'VERSION').read_text().strip(), '1.0.4')
self.assertEqual((ROOT / 'VERSION').read_text().strip(), '1.0.5')
en = json.loads((ROOT/'app/locales/en.json').read_text())
self.assertGreaterEqual(len(en), 1098)
for lang in LANGS:
+25
View File
@@ -0,0 +1,25 @@
import pytest
from app.core import preferences
from app import main
def test_service_policy_and_validation(tmp_path, monkeypatch):
monkeypatch.setattr(preferences, 'DATABASE_PATH', str(tmp_path / 'settings.db'))
monkeypatch.setattr(main, 'audit_username', lambda request: 'jan')
assert not preferences.get_service_policy()['enabled']
with pytest.raises(ValueError):
preferences.update_service_policy(True, 'list', [])
preferences.update_service_policy(True, 'list', ['WireGuard', 'WireGuard'])
request = main.ExtendedForwardRequest(public_ip='192.0.2.1', public_port=80, target_ip='10.0.0.2', target_port=80, protocol='tcp', service='WireGuard')
with pytest.raises(ValueError):
main.forward_payload(request, None)
request.confirmation = main.SERVICE_CONFIRMATION
result = main.forward_payload(request, None)
assert result['responsibility']['user'] == 'jan'
request.service = 'inny'
with pytest.raises(ValueError):
main.forward_payload(request, None)
preferences.update_service_policy(True, 'combo', ['WireGuard'])
assert main.forward_payload(request, None)['service'] == 'inny'
preferences.update_service_policy(True, 'custom', [])
assert main.forward_payload(request, None)['service'] == 'inny'