annotate ui/tests/windowsstoretest.cpp @ 812:c4af7874250b

Temporary enable release resource for test builds
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 15 Jul 2014 16:41:27 +0200
parents 854248d81ba4
children 317ee9dc4684
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 249
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 249
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 249
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 249
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 249
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 249
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 249
diff changeset
7 */
220
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
8 #include "windowsstoretest.h"
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
9 #include "certificatelist.h"
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
10 #include "strhelp.h"
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
11 #include "certificate.h"
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
12 #include "../cinst/windowsstore.h"
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
13
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
14 #include <QTest>
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
15
222
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
16 void WindowsStoreTest::dumpContents() {
602
854248d81ba4 Fully switch to unicode for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
17 wchar_t pszNameString[256];
222
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
18 PCCERT_CONTEXT pCert = NULL;
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
19 qDebug() << "Currently in store: " ;
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
20 while((pCert = CertEnumCertificatesInStore(testStore, pCert))) {
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
21 if(CertGetNameString(pCert,
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
22 CERT_NAME_SIMPLE_DISPLAY_TYPE,
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
23 0,
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
24 NULL,
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
25 pszNameString,
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
26 128)){
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
27 qDebug() << " " << pszNameString ;
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
28 }
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
29 }
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
30 }
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
31
220
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
32 void WindowsStoreTest::initTestCase() {
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
33 testStore = CertOpenStore(
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
34 CERT_STORE_PROV_MEMORY, // A memory store
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
35 0, // Encoding type
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
36 // Not used with a memory store
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
37 0, // Use the default provider
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
38 0, // No flags
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
39 NULL); // Not needed
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
40 QVERIFY (testStore);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
41 QFile res(":/list-valid-signed.txt");
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
42 res.open(QIODevice::ReadOnly);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
43 tmpFile.open();
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
44 tmpFile.write(res.readAll());
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
45 tmpFile.close();
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
46
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
47 validList = CertificateList(tmpFile.fileName().toLocal8Bit().data());
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
48 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
49
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
50 void WindowsStoreTest::testInstRemove() {
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
51 char ** to_install = NULL,
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
52 ** to_remove = NULL;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
53 PCCERT_CONTEXT pCert = NULL;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
54 size_t i = 0;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
55
249
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
56 QList<Certificate> instList;
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
57
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
58 foreach (const Certificate &cert, validList.getCertificates()) {
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
59 if (cert.isInstallCert())
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
60 instList << cert;
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
61 }
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
62
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
63
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
64 foreach (const Certificate &cert, instList) {
220
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
65 strv_append (&to_install, cert.base64Line().toLatin1().constData() + 2,
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
66 cert.base64Line().size() - 2);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
67 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
68
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
69 /* Just a quick check for str_append_str functionality */
249
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
70 QVERIFY((size_t) instList.size() == strv_length(to_install));
220
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
71 for (i = 0; i < strv_length(to_install); i++) {
249
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
72 QVERIFY (instList[i].base64Line().right(
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
73 instList[i].base64Line().size() - 2) ==
220
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
74 QString::fromLatin1(to_install[i]));
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
75 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
76
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
77 do_install(testStore, to_install);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
78
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
79 i = 0;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
80 while((pCert = CertEnumCertificatesInStore(testStore, pCert))) {
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
81 bool certFound = false;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
82 QByteArray data = QByteArray::fromRawData ((const char *)pCert->pbCertEncoded,
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
83 pCert->cbCertEncoded);
249
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
84 foreach (const Certificate &cert, instList) {
220
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
85 QByteArray asn1data = QByteArray::fromBase64(
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
86 cert.base64Line().right(cert.base64Line().size() - 2).toLatin1());
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
87 if (asn1data == data) {
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
88 certFound = true;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
89 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
90 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
91 QVERIFY(certFound);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
92 i++;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
93 }
249
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
94 QVERIFY ((size_t)instList.size() == i);
220
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
95
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
96 /* Remove all except one */
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
97 for (i = 0; i < strv_length(to_install) - 1; i++) {
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
98 strv_append(&to_remove, to_install[i], qstrlen(to_install[i]));
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
99 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
100
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
101 do_remove(testStore, to_remove);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
102
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
103 i = 0;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
104 while((pCert = CertEnumCertificatesInStore(testStore, pCert))) {
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
105 i++;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
106 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
107
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
108 QVERIFY(i == 1);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
109
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
110 /* Remove that too */
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
111 strv_free(to_remove);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
112 to_remove = NULL;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
113 strv_append(&to_remove, to_install[strv_length(to_install) - 1],
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
114 qstrlen(to_install[strv_length(to_install) - 1]));
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
115
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
116 do_remove(testStore, to_remove);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
117
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
118 QVERIFY (CertEnumCertificatesInStore(testStore, pCert) == NULL);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
119
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
120 /* Install them all again */
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
121 do_install(testStore, to_install);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
122 strv_free(to_remove);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
123 to_remove = NULL;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
124 strv_append(&to_remove, to_install[strv_length(to_install) - 1],
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
125 qstrlen(to_install[strv_length(to_install) - 1]));
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
126 do_remove(testStore, to_remove);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
127
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
128 i = 0;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
129 while((pCert = CertEnumCertificatesInStore(testStore, pCert))) {
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
130 bool certFound = false;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
131 QByteArray data = QByteArray::fromRawData((const char*) pCert->pbCertEncoded,
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
132 pCert->cbCertEncoded);
222
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
133 QVERIFY (data.toBase64() != to_remove[0]);
249
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
134 for (int j = 0; j < instList.size() - 1; j++) {
6a7eb102716d Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents: 222
diff changeset
135 const Certificate &cert = instList[j];
220
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
136 QByteArray asn1data = QByteArray::fromBase64(
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
137 cert.base64Line().right(cert.base64Line().size() - 2).toLatin1());
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
138 if (asn1data == data) {
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
139 certFound = true;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
140 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
141 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
142 QVERIFY(certFound);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
143 i++;
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
144 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
145
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
146 QVERIFY(i == strv_length(to_install) - 1);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
147
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
148 /* Install all again and remove them afterwards */
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
149 do_install(testStore, to_install);
222
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
150 do_remove(testStore, to_install);
53ea9b975d1c Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents: 220
diff changeset
151
220
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
152 QVERIFY (CertEnumCertificatesInStore(testStore, pCert) == NULL);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
153
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
154 strv_free(to_install);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
155 strv_free(to_remove);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
156 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
157
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
158 void WindowsStoreTest::cleanupTestCase() {
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
159 CertCloseStore(testStore, 0);
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
160 }
e6c5c70a67b0 Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
161 QTEST_GUILESS_MAIN (WindowsStoreTest);

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