Mercurial > trustbridge
annotate ui/tests/windowsstoretest.cpp @ 401:e11409381e16
Changed path for load certificatelist and add certificate.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 16 Apr 2014 11:03:18 +0200 |
parents | 6a7eb102716d |
children | 17e1c8f37d72 |
rev | line source |
---|---|
220
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 #include "windowsstoretest.h" |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
2 #include "certificatelist.h" |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 #include "strhelp.h" |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 #include "certificate.h" |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 #include "../cinst/windowsstore.h" |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 #include <QTest> |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 |
222
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
9 void WindowsStoreTest::dumpContents() { |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
10 char pszNameString[256]; |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
11 PCCERT_CONTEXT pCert = NULL; |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
12 qDebug() << "Currently in store: " ; |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
13 while((pCert = CertEnumCertificatesInStore(testStore, pCert))) { |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
14 if(CertGetNameString(pCert, |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
15 CERT_NAME_SIMPLE_DISPLAY_TYPE, |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
16 0, |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
17 NULL, |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
18 pszNameString, |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
19 128)){ |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
20 qDebug() << " " << pszNameString ; |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
21 } |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
22 } |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
23 } |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
24 |
220
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 void WindowsStoreTest::initTestCase() { |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 testStore = CertOpenStore( |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
27 CERT_STORE_PROV_MEMORY, // A memory store |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
28 0, // Encoding type |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 // Not used with a memory store |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
30 0, // Use the default provider |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
31 0, // No flags |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
32 NULL); // Not needed |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 QVERIFY (testStore); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 QFile res(":/list-valid-signed.txt"); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 res.open(QIODevice::ReadOnly); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
36 tmpFile.open(); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
37 tmpFile.write(res.readAll()); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
38 tmpFile.close(); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
39 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
40 validList = CertificateList(tmpFile.fileName().toLocal8Bit().data()); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
41 } |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
42 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
43 void WindowsStoreTest::testInstRemove() { |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
44 char ** to_install = NULL, |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
45 ** to_remove = NULL; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
46 PCCERT_CONTEXT pCert = NULL; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
47 size_t i = 0; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
48 |
249
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
49 QList<Certificate> instList; |
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
50 |
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
51 foreach (const Certificate &cert, validList.getCertificates()) { |
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
52 if (cert.isInstallCert()) |
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
53 instList << cert; |
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
54 } |
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
55 |
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
56 |
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
57 foreach (const Certificate &cert, instList) { |
220
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
58 strv_append (&to_install, cert.base64Line().toLatin1().constData() + 2, |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
59 cert.base64Line().size() - 2); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
60 } |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
61 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
62 /* 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
|
63 QVERIFY((size_t) instList.size() == strv_length(to_install)); |
220
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
64 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
|
65 QVERIFY (instList[i].base64Line().right( |
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
66 instList[i].base64Line().size() - 2) == |
220
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
67 QString::fromLatin1(to_install[i])); |
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 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
70 do_install(testStore, to_install); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
71 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
72 i = 0; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
73 while((pCert = CertEnumCertificatesInStore(testStore, pCert))) { |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
74 bool certFound = false; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
75 QByteArray data = QByteArray::fromRawData ((const char *)pCert->pbCertEncoded, |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
76 pCert->cbCertEncoded); |
249
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
77 foreach (const Certificate &cert, instList) { |
220
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
78 QByteArray asn1data = QByteArray::fromBase64( |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
79 cert.base64Line().right(cert.base64Line().size() - 2).toLatin1()); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
80 if (asn1data == data) { |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
81 certFound = true; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
82 } |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
83 } |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
84 QVERIFY(certFound); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
85 i++; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
86 } |
249
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
87 QVERIFY ((size_t)instList.size() == i); |
220
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
88 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
89 /* Remove all except one */ |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
90 for (i = 0; i < strv_length(to_install) - 1; i++) { |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
91 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
|
92 } |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
93 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
94 do_remove(testStore, to_remove); |
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 i = 0; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
97 while((pCert = CertEnumCertificatesInStore(testStore, pCert))) { |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
98 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 QVERIFY(i == 1); |
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 /* Remove that too */ |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
104 strv_free(to_remove); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
105 to_remove = NULL; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
106 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
|
107 qstrlen(to_install[strv_length(to_install) - 1])); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
108 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
109 do_remove(testStore, to_remove); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
110 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
111 QVERIFY (CertEnumCertificatesInStore(testStore, pCert) == NULL); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
112 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
113 /* Install them all again */ |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
114 do_install(testStore, to_install); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
115 strv_free(to_remove); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
116 to_remove = NULL; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
117 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
|
118 qstrlen(to_install[strv_length(to_install) - 1])); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
119 do_remove(testStore, to_remove); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
120 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
121 i = 0; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
122 while((pCert = CertEnumCertificatesInStore(testStore, pCert))) { |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
123 bool certFound = false; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
124 QByteArray data = QByteArray::fromRawData((const char*) pCert->pbCertEncoded, |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
125 pCert->cbCertEncoded); |
222
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
126 QVERIFY (data.toBase64() != to_remove[0]); |
249
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
222
diff
changeset
|
127 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
|
128 const Certificate &cert = instList[j]; |
220
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
129 QByteArray asn1data = QByteArray::fromBase64( |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
130 cert.base64Line().right(cert.base64Line().size() - 2).toLatin1()); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
131 if (asn1data == data) { |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
132 certFound = true; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
133 } |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
134 } |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
135 QVERIFY(certFound); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
136 i++; |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
137 } |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
138 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
139 QVERIFY(i == strv_length(to_install) - 1); |
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 /* Install all again and remove them afterwards */ |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
142 do_install(testStore, to_install); |
222
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
143 do_remove(testStore, to_install); |
53ea9b975d1c
Cleanup windowsstore.c
Andre Heinecke <aheinecke@intevation.de>
parents:
220
diff
changeset
|
144 |
220
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
145 QVERIFY (CertEnumCertificatesInStore(testStore, pCert) == NULL); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
146 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
147 strv_free(to_install); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
148 strv_free(to_remove); |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
149 } |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
150 |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
151 void WindowsStoreTest::cleanupTestCase() { |
e6c5c70a67b0
Add test for windowsstores
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
152 CertCloseStore(testStore, 0); |
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 QTEST_GUILESS_MAIN (WindowsStoreTest); |