@@ -60,14 +60,14 @@ void TestQgsAuthConfig::cleanupTestCase()
60
60
void TestQgsAuthConfig::testMethodConfig ()
61
61
{
62
62
QgsAuthMethodConfig mconfig;
63
- Q_ASSERT ( !mconfig.isValid () );
63
+ QVERIFY ( !mconfig.isValid () );
64
64
65
65
mconfig.setName ( " Some Name" );
66
66
mconfig.setMethod ( " MethodKey" );
67
- Q_ASSERT ( mconfig.isValid () );
67
+ QVERIFY ( mconfig.isValid () );
68
68
69
69
mconfig.setId ( " 0000000" );
70
- Q_ASSERT ( mconfig.isValid ( true ) );
70
+ QVERIFY ( mconfig.isValid ( true ) );
71
71
72
72
mconfig.setVersion ( 1 );
73
73
mconfig.setUri ( " http://example.com" );
@@ -89,7 +89,7 @@ void TestQgsAuthConfig::testMethodConfig()
89
89
QCOMPARE ( mconfig.configString (), confstr );
90
90
91
91
mconfig.clearConfigMap ();
92
- Q_ASSERT ( mconfig.configMap ().isEmpty () );
92
+ QVERIFY ( mconfig.configMap ().isEmpty () );
93
93
94
94
mconfig.setConfig ( " key1" , " value1" );
95
95
mconfig.setConfig ( " key2" , " value2" );
@@ -102,65 +102,62 @@ void TestQgsAuthConfig::testMethodConfig()
102
102
QCOMPARE ( mconfig.config ( " key1" ), QString ( " value1" ) );
103
103
QCOMPARE ( mconfig.configList ( " key3" ), key3list );
104
104
105
- Q_ASSERT ( mconfig.hasConfig ( " key2" ) );
105
+ QVERIFY ( mconfig.hasConfig ( " key2" ) );
106
106
mconfig.removeConfig ( " key2" );
107
- Q_ASSERT ( !mconfig.hasConfig ( " key2" ) );
107
+ QVERIFY ( !mconfig.hasConfig ( " key2" ) );
108
108
109
109
mconfig.loadConfigString ( confstr );
110
110
QCOMPARE ( mconfig.configMap (), confmap );
111
111
QCOMPARE ( mconfig.configString (), confstr );
112
112
113
113
QgsAuthMethodConfig mconfig2 ( mconfig );
114
- Q_ASSERT ( mconfig2 == mconfig );
114
+ QVERIFY ( mconfig2 == mconfig );
115
115
116
116
mconfig.setMethod ( " MethodKey2" );
117
- Q_ASSERT ( mconfig2 != mconfig );
117
+ QVERIFY ( mconfig2 != mconfig );
118
118
}
119
119
120
120
void TestQgsAuthConfig::testPkiBundle ()
121
121
{
122
122
QgsPkiBundle bundle;
123
- Q_ASSERT ( bundle.isNull () );
124
- Q_ASSERT ( !bundle.isValid () );
123
+ QVERIFY ( bundle.isNull () );
124
+ QVERIFY ( !bundle.isValid () );
125
125
126
126
QList<QSslCertificate> cacerts ( QSslCertificate::fromPath ( smPkiData + " /chain_subissuer-issuer-root.pem" ) );
127
- Q_ASSERT ( !cacerts.isEmpty () );
127
+ QVERIFY ( !cacerts.isEmpty () );
128
128
QCOMPARE ( cacerts.size (), 3 );
129
129
QgsPkiBundle bundle2 ( QgsPkiBundle::fromPemPaths ( smPkiData + " /fra_cert.pem" ,
130
130
smPkiData + " /fra_key_w-pass.pem" ,
131
131
" password" ,
132
132
cacerts ) );
133
- Q_ASSERT ( !bundle2.isNull () );
134
- Q_ASSERT ( bundle2.isValid () );
133
+ QVERIFY ( !bundle2.isNull () );
134
+ QVERIFY ( bundle2.isValid () );
135
135
QCOMPARE ( bundle2.certId (), QString ( " c3633c428d441853973e5081ba9be39f667f5af6" ) );
136
136
137
137
QSslCertificate clientcert ( bundle2.clientCert () );
138
- Q_ASSERT ( !clientcert.isNull () );
139
- QSslKey clientkey ( bundle2.clientKey ( true ) );
140
- Q_ASSERT ( !clientkey.isNull () );
141
- QString keypass ( bundle2.keyPassphrase () );
142
- Q_ASSERT ( !keypass.isEmpty () );
138
+ QVERIFY ( !clientcert.isNull () );
139
+ QSslKey clientkey ( bundle2.clientKey () );
140
+ QVERIFY ( !clientkey.isNull () );
143
141
QList<QSslCertificate> cachain ( bundle2.caChain () );
144
- Q_ASSERT ( !cachain.isEmpty () );
142
+ QVERIFY ( !cachain.isEmpty () );
145
143
QCOMPARE ( cachain.size (), 3 );
146
144
147
- QgsPkiBundle bundle3 ( clientcert, clientkey, keypass, cachain );
148
- Q_ASSERT ( !bundle3.isNull () );
149
- Q_ASSERT ( bundle3.isValid () );
145
+ QgsPkiBundle bundle3 ( clientcert, clientkey, cachain );
146
+ QVERIFY ( !bundle3.isNull () );
147
+ QVERIFY ( bundle3.isValid () );
150
148
151
149
bundle.setClientCert ( clientcert );
152
150
bundle.setClientKey ( clientkey );
153
- bundle.setKeyPassphrase ( keypass );
154
151
bundle.setCaChain ( cachain );
155
- Q_ASSERT ( !bundle.isNull () );
156
- Q_ASSERT ( bundle.isValid () );
152
+ QVERIFY ( !bundle.isNull () );
153
+ QVERIFY ( bundle.isValid () );
157
154
158
155
QgsPkiBundle bundle4 ( QgsPkiBundle::fromPkcs12Paths ( smPkiData + " /fra_w-chain.p12" ,
159
156
" password" ) );
160
- Q_ASSERT ( !bundle4.isNull () );
161
- Q_ASSERT ( bundle4.isValid () );
157
+ QVERIFY ( !bundle4.isNull () );
158
+ QVERIFY ( bundle4.isValid () );
162
159
QList<QSslCertificate> cachain4 ( bundle2.caChain () );
163
- Q_ASSERT ( !cachain4.isEmpty () );
160
+ QVERIFY ( !cachain4.isEmpty () );
164
161
QCOMPARE ( cachain4.size (), 3 );
165
162
}
166
163
@@ -172,7 +169,7 @@ void TestQgsAuthConfig::testPkiConfigBundle()
172
169
mconfig.setId ( " 0000000" );
173
170
mconfig.setVersion ( 1 );
174
171
mconfig.setUri ( " http://example.com" );
175
- Q_ASSERT ( mconfig.isValid ( true ) );
172
+ QVERIFY ( mconfig.isValid ( true ) );
176
173
177
174
QSslCertificate clientcert ( QSslCertificate::fromPath ( smPkiData + " /gerardus_cert.pem" ).first () );
178
175
QByteArray keydata;
@@ -183,15 +180,15 @@ void TestQgsAuthConfig::testPkiConfigBundle()
183
180
QSslKey clientkey ( keydata, QSsl::Rsa );
184
181
185
182
QgsPkiConfigBundle bundle ( mconfig, clientcert, clientkey );
186
- Q_ASSERT ( bundle.isValid () );
183
+ QVERIFY ( bundle.isValid () );
187
184
QCOMPARE ( bundle.config (), mconfig );
188
185
189
186
QCOMPARE ( bundle.clientCert (), clientcert );
190
187
QCOMPARE ( bundle.clientCertKey (), clientkey );
191
188
bundle.setConfig ( mconfig );
192
189
bundle.setClientCert ( clientcert );
193
190
bundle.setClientCertKey ( clientkey );
194
- Q_ASSERT ( bundle.isValid () );
191
+ QVERIFY ( bundle.isValid () );
195
192
QCOMPARE ( bundle.config (), mconfig );
196
193
QCOMPARE ( bundle.clientCert (), clientcert );
197
194
QCOMPARE ( bundle.clientCertKey (), clientkey );
@@ -204,8 +201,12 @@ void TestQgsAuthConfig::testConfigSslServer()
204
201
QSslCertificate sslcert ( QSslCertificate::fromPath ( smPkiData + " /localhost_ssl_cert.pem" ).first () );
205
202
206
203
QgsAuthConfigSslServer sslconfig;
207
- Q_ASSERT ( sslconfig.isNull () );
204
+ QVERIFY ( sslconfig.isNull () );
205
+ #if QT_VERSION >= 0x040800
208
206
QCOMPARE ( sslconfig.qtVersion (), 480 );
207
+ #else
208
+ QCOMPARE ( sslconfig.qtVersion (), 470 );
209
+ #endif
209
210
QCOMPARE ( sslconfig.version (), 1 );
210
211
QCOMPARE ( sslconfig.sslPeerVerifyMode (), QSslSocket::VerifyPeer );
211
212
@@ -219,7 +220,7 @@ void TestQgsAuthConfig::testConfigSslServer()
219
220
QList<QSslError::SslError> sslerrenums;
220
221
sslerrenums << QSslError::SelfSignedCertificateInChain << QSslError::SubjectIssuerMismatch;
221
222
sslconfig.setSslIgnoredErrorEnums ( sslerrenums );
222
- Q_ASSERT ( !sslconfig.isNull () );
223
+ QVERIFY ( !sslconfig.isNull () );
223
224
224
225
QCOMPARE ( sslconfig.configString (), confstr );
225
226
QCOMPARE ( sslconfig.sslHostPort (), hostport );
0 commit comments