summaryrefslogtreecommitdiff
path: root/xmlsecurity/qa/uitest
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2024-07-31 14:42:57 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2024-08-01 11:18:30 +0200
commit8ed755cfb0779c3e1119d17a7877768af1a01682 (patch)
treef8842c2b6563f0ac8f469e189e8b4fddf7996b69 /xmlsecurity/qa/uitest
parente3d5b3a5ea384fff2553ede8873be274af0f11f1 (diff)
pyuno,unotest,xmlsecurity: copy GPG test files for UITtest
The problem was that running UITest_xmlsecurity_gpg changed the files in test/signing-keys/ ... prevent that by copying the directory in that test, which is more complicated than initially expected. Change-Id: Ie3be922e0b2e9dae49f9a70e35ad5270c90b4fc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171322 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'xmlsecurity/qa/uitest')
-rw-r--r--xmlsecurity/qa/uitest/gpg/encrypt.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/xmlsecurity/qa/uitest/gpg/encrypt.py b/xmlsecurity/qa/uitest/gpg/encrypt.py
index ca2fa5f87f9c..70c9c0e9ffc1 100644
--- a/xmlsecurity/qa/uitest/gpg/encrypt.py
+++ b/xmlsecurity/qa/uitest/gpg/encrypt.py
@@ -9,8 +9,11 @@
from uitest.framework import UITestCase
from libreoffice.uno.propertyvalue import mkPropertyValues
+import pyuno
from tempfile import TemporaryDirectory
+from urllib.parse import urljoin, urlparse
+from urllib.request import url2pathname
import os.path
@@ -19,6 +22,23 @@ import os.path
# Requires the environment variable GNUPGHOME to be set correctly.
# See solenv/gbuild/UITest.mk
class GpgEncryptTest(UITestCase):
+
+ # should this be setUp() or setUpClass()?
+ # as setUp(), any test's change to the files should be overwritten before
+ # the next test, which could be an advantage.
+ def setUp(self):
+ testdir = os.getenv("TestUserDir")
+ certdir = urljoin(testdir, "signing-keys")
+ # this sets GNUPGHOME so do it before starting soffice
+ pyuno.private_initTestEnvironmentGPG(certdir)
+ # ugly: set var here again because "os.environ" is a copy :(
+ os.environ["GNUPGHOME"] = url2pathname(urlparse(certdir).path)
+ super().setUp()
+
+ def tearDown(self):
+ super().tearDown()
+ pyuno.private_deinitTestEnvironmentGPG()
+
def test_gpg_encrypt(self):
# TODO: Maybe deduplicate with sw/qa/uitest/writer_tests8/save_with_password_test_policy.py
with TemporaryDirectory() as tempdir: