comparison ui/tests/downloadertest.cpp @ 46:d28e2624c1d5

Reset connection before the next request. This makes the downloader work for the first simple test.
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 17 Mar 2014 10:51:47 +0000
parents c6125d73faf4
children 7e37c6033c81
comparison
equal deleted inserted replaced
45:c6125d73faf4 46:d28e2624c1d5
24 "SSLcertFile = " << SOURCE_DIR << 24 "SSLcertFile = " << SOURCE_DIR <<
25 "/data/valid_ssl_bp_priv.pem" << endl << 25 "/data/valid_ssl_bp_priv.pem" << endl <<
26 "Interface = 127.0.0.1" << endl << 26 "Interface = 127.0.0.1" << endl <<
27 "}" << endl << 27 "}" << endl <<
28 "Hostname = 127.0.0.1" << endl << 28 "Hostname = 127.0.0.1" << endl <<
29 "WebsiteRoot = " << SOURCE_DIR << endl; 29 "WebsiteRoot = " << SOURCE_DIR << "/data" << endl;
30 configStream.flush(); 30 configStream.flush();
31 31
32 serverConfig.close(); 32 serverConfig.close();
33 serverProc.start(); 33 serverProc.start();
34 serverProc.waitForStarted(); 34 serverProc.waitForStarted();
58 Downloader* downloader = new Downloader(this, 58 Downloader* downloader = new Downloader(this,
59 QString::fromLatin1("https://localhost:44443"), 59 QString::fromLatin1("https://localhost:44443"),
60 validCert.readAll(), 60 validCert.readAll(),
61 QDateTime::currentDateTime(), // Last installed SW 61 QDateTime::currentDateTime(), // Last installed SW
62 QDateTime::fromString("2010", "YYYY"), 62 QDateTime::fromString("2010", "YYYY"),
63 "/list-valid.txt", 63 "/random_2MB",
64 "/random_2MB"); 64 "/list-valid.txt");
65 validCert.close(); 65 validCert.close();
66 66
67 QSignalSpy newListAvailable(downloader, 67 QSignalSpy newListAvailable(downloader,
68 SIGNAL(newListAvailable(const QString&, const QDateTime&))); 68 SIGNAL(newListAvailable(const QString&, const QDateTime&)));
69 QSignalSpy newSoftwareAvailable(downloader, 69 QSignalSpy newSoftwareAvailable(downloader,
76 downloader->start(); 76 downloader->start();
77 77
78 int waited = 0; 78 int waited = 0;
79 while (newListAvailable.count() == 0 && 79 while (newListAvailable.count() == 0 &&
80 errors.count() == 0 && waited < 20) { 80 errors.count() == 0 && waited < 20) {
81 QTest::qWait(200); 81 QTest::qWait(2000);
82 waited++; 82 waited++;
83 } 83 }
84 QVERIFY(waited != 20); 84 QVERIFY(waited != 20);
85 QVERIFY(newListAvailable.count() == 1); 85 QVERIFY(newListAvailable.count() == 1);
86 QVERIFY(newSoftwareAvailable.count() == 0); 86 QVERIFY(newSoftwareAvailable.count() == 0);

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