comparison ui/tests/downloadertest.cpp @ 994:8fb1b912fd8e

Add test using the default download server used by the software This should help to highlight problems in the real environement but needs to be adapted when the server / server layout changes just as the software..
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 01 Sep 2014 13:14:10 +0200
parents 2949f1842955
children daa9448b64f5
comparison
equal deleted inserted replaced
993:561cc777e0b6 994:8fb1b912fd8e
226 arguments.at(0).toString())); 226 arguments.at(0).toString()));
227 227
228 delete downloader; 228 delete downloader;
229 } 229 }
230 230
231 void DownloaderTest::testDefaultUrl()
232 {
233 /* This test might fail if SERVER_URL is configured differently
234 * and needs to be adapted once there is a public download server.
235 * This test also needs internet connectivity. */
236 Downloader* downloader = new Downloader(this,
237 QString::fromLatin1(SERVER_URL),
238 QByteArray(),
239 QDateTime::currentDateTime(), // Last installed SW
240 QDateTime::fromString("2010", "YYYY"),
241 QString("/users/aheinecke/zertifikatsliste.txt"),
242 QString("/users/aheinecke/zertifikatsliste.txt"));
243
244 SETUP_SPY
245
246 connect(downloader, SIGNAL(error(const QString &, SSLConnection::ErrorCode)),
247 this, SLOT(downloaderError(const QString &, SSLConnection::ErrorCode)));
248
249 downloader->start();
250
251 int waited = 0;
252 while (newListAvailable.count() == 0 &&
253 errors.count() == 0 && waited < 20) {
254 QTest::qWait(200);
255 waited++;
256 }
257 QVERIFY(waited != 20);
258 QVERIFY(newListAvailable.count() == 1);
259 QVERIFY(newSoftwareAvailable.count() == 0);
260 QVERIFY(errors.count() == 0);
261
262 delete downloader;
263 }
264
231 void DownloaderTest::testNewList() 265 void DownloaderTest::testNewList()
232 { 266 {
233 QFile validCert(QString::fromLatin1(SOURCE_DIR) + 267 QFile validCert(QString::fromLatin1(SOURCE_DIR) +
234 "/data/valid_ssl_bp.pem"); 268 "/data/valid_ssl_bp.pem");
235 validCert.open(QIODevice::ReadOnly); 269 validCert.open(QIODevice::ReadOnly);

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