diff ui/tests/nsstest.cpp @ 830:344d15e23f6c

Add nss shared db data and use it.
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 24 Jul 2014 12:09:28 +0200
parents c262ee333c56
children 317ee9dc4684
line wrap: on
line diff
--- a/ui/tests/nsstest.cpp	Thu Jul 24 11:41:52 2014 +0200
+++ b/ui/tests/nsstest.cpp	Thu Jul 24 12:09:28 2014 +0200
@@ -95,14 +95,20 @@
     /* Copy the current systems NSSSHARED db in the fake home for benchmark tests */
     QDir fakeNSSSharedDir = fakeHome.path() + "/.pki/nssdb";
     QVERIFY(fakeNSSSharedDir.mkpath(fakeNSSSharedDir.path()));
-    qDebug() << "Copying: " << QDir::homePath() + "/.pki/nssdb/cert9.db" <<
-            " to " << fakeNSSSharedDir.path() + "cert9.db";
-    QVERIFY(QFile::copy(QDir::homePath() + "/.pki/nssdb/cert9.db",
+    QVERIFY(QFile::copy(":/nss/pki-nssdb/cert9.db",
             fakeNSSSharedDir.path() + "cert9.db"));
-    QVERIFY(QFile::copy(QDir::homePath() + "/.pki/nssdb/key4.db",
+    QVERIFY(QFile::copy(":/nss/pki-nssdb/key4.db",
             fakeNSSSharedDir.path() + "key4.db"));
-    QVERIFY(QFile::copy(QDir::homePath() + "/.pki/nssdb/pkcs11.txt",
-            fakeNSSSharedDir.path() + "pkcs11.txt"));
+    QFile pkcs11(":/nss/pki-nssdb/pkcs11.txt");
+    pkcs11.open(QIODevice::ReadOnly);
+
+    QString pkcs11content = pkcs11.readAll();
+    pkcs11.close();
+    pkcs11content.replace("TOREPLACE", fakeNSSSharedDir.path());
+    QFile p11outfile (fakeNSSSharedDir.path() + "pkcs11.txt");
+    p11outfile.open(QIODevice::WriteOnly);
+    p11outfile.write(pkcs11content.toUtf8());
+    p11outfile.close();
 
     QVERIFY(!setenv ("HOME", fakeHome.path().toLocal8Bit().constData(), 1));
 #else

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