changeset 306:9c5e6b142611

Set the home directory to a temporary location to avoid writing into real nss stores
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 03 Apr 2014 15:30:25 +0200
parents 4a3febc6d806
children 2fd69803d219
files ui/tests/cinstprocesstest.cpp ui/tests/cinstprocesstest.h
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ui/tests/cinstprocesstest.cpp	Thu Apr 03 15:29:58 2014 +0200
+++ b/ui/tests/cinstprocesstest.cpp	Thu Apr 03 15:30:25 2014 +0200
@@ -96,6 +96,14 @@
     otherList = CertificateList(otherListFile.fileName().toLocal8Bit().data());
 
     QVERIFY(!otherList.isValid());
+
+/* Set HOME or APPDATA so that nss stores are not touched 
+ * see nsstest for the real test of that code */
+#ifdef WIN32
+    QVERIFY(!setenv ("APPDATA", fakeHome.path().toLocal8Bit().constData(), 1));
+#else
+    QVERIFY(!setenv ("HOME", fakeHome.path().toLocal8Bit().constData(), 1));
+#endif
 }
 
 void CinstProcessTest::testNoList() {
--- a/ui/tests/cinstprocesstest.h	Thu Apr 03 15:29:58 2014 +0200
+++ b/ui/tests/cinstprocesstest.h	Thu Apr 03 15:30:25 2014 +0200
@@ -9,6 +9,7 @@
 #include <QStringList>
 #include <QProcess>
 #include <QTemporaryFile>
+#include <QTemporaryDir>
 #include <QTest>
 #include "certificatelist.h"
 
@@ -21,6 +22,7 @@
     QTemporaryFile validListFile;
     QTemporaryFile otherListFile;
     QTemporaryFile invalidListFile;
+    QTemporaryDir fakeHome;
     CertificateList validList;
     CertificateList otherList;
     CertificateList invalidList;

http://wald.intevation.org/projects/trustbridge/