mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
[Tests] Updated tests to current API.
Make PACTest::inNetTest pass by using qupzilla.com (with stable IP) instead of google.com.
This commit is contained in:
parent
a7044e36ea
commit
da46d140bb
|
@ -138,7 +138,7 @@ void FormCompleterTest::extractFormTest1()
|
|||
|
||||
PageFormData form = extractFormData(html, data);
|
||||
|
||||
QVERIFY(form.found == true);
|
||||
QVERIFY(form.isValid() == true);
|
||||
QCOMPARE(form.username, QString("tst_username"));
|
||||
QCOMPARE(form.password, QString("tst_password"));
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void FormCompleterTest::extractFormTest2()
|
|||
|
||||
PageFormData form = extractFormData(html, data);
|
||||
|
||||
QVERIFY(form.found == true);
|
||||
QVERIFY(form.isValid() == true);
|
||||
QCOMPARE(form.username, QString::fromUtf8("+ě ++ éí§`]|~đ11 +!:"));
|
||||
QCOMPARE(form.password, QString::fromUtf8("+ěš asn~đ°#&# |€"));
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ void FormCompleterTest::extractFormTest3()
|
|||
|
||||
PageFormData form = extractFormData(html + html2, data);
|
||||
|
||||
QVERIFY(form.found == true);
|
||||
QVERIFY(form.isValid() == true);
|
||||
QCOMPARE(form.username, QString("tst_username"));
|
||||
QCOMPARE(form.password, QString("tst_password"));
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ void FormCompleterTest::extractFormTest4()
|
|||
|
||||
PageFormData form = extractFormData(html, data);
|
||||
|
||||
QVERIFY(form.found == true);
|
||||
QVERIFY(form.isValid() == true);
|
||||
QCOMPARE(form.username, QString());
|
||||
QCOMPARE(form.password, QString("tst_password"));
|
||||
}
|
||||
|
@ -258,11 +258,28 @@ void FormCompleterTest::extractFormTest5()
|
|||
|
||||
PageFormData form = extractFormData(html, data);
|
||||
|
||||
QVERIFY(form.found == true);
|
||||
QVERIFY(form.isValid() == true);
|
||||
QCOMPARE(form.username, QString("user1"));
|
||||
QCOMPARE(form.password, QString("pass"));
|
||||
}
|
||||
|
||||
void FormCompleterTest::extractFormTest6()
|
||||
{
|
||||
// Not found form test
|
||||
|
||||
QByteArray data = "username=tst_username&password=tst_password";
|
||||
|
||||
QString html = "<form name='form1' method='post' action='foo.php'>"
|
||||
"<input id='id1' type='text' name='username' value='tst_username'>"
|
||||
"<input id='id2' type='password' name='passwordinvalid' value='tst_password'>"
|
||||
"<input type='submit' value='submit' name='submit'>"
|
||||
"</form>";
|
||||
|
||||
PageFormData form = extractFormData(html, data);
|
||||
|
||||
QVERIFY(form.isValid() == false);
|
||||
}
|
||||
|
||||
void FormCompleterTest::completeWithData(const QString &html, const QByteArray &data)
|
||||
{
|
||||
view->setHtml(html);
|
||||
|
|
|
@ -43,6 +43,7 @@ private slots:
|
|||
void extractFormTest3();
|
||||
void extractFormTest4();
|
||||
void extractFormTest5();
|
||||
void extractFormTest6();
|
||||
|
||||
private:
|
||||
void completeWithData(const QString &html, const QByteArray &data);
|
||||
|
|
|
@ -135,9 +135,9 @@ void PacTest::isInNetTest_data()
|
|||
QTest::newRow("doc2-3") << "128.94.249.79" << "198.95.0.0" << "255.255.0.0" << false;
|
||||
QTest::newRow("doc2-3") << "23.94.249.79" << "198.95.0.0" << "255.255.0.0" << false;
|
||||
|
||||
// is true if the IP address of host matches 173.194.70.* (google.com)
|
||||
// is true if the IP address of host matches 88.208.118.* (qupzilla.com)
|
||||
// if host is passed as hostname, the function needs to resolve it
|
||||
QTest::newRow("resolve1") << "google.com" << "173.194.70.0" << "255.255.255.0" << true;
|
||||
QTest::newRow("resolve1") << "qupzilla.com" << "88.208.118.158" << "255.255.255.0" << true;
|
||||
QTest::newRow("resolve1-2") << "yahoo.com" << "173.194.70.0" << "255.255.255.0" << false;
|
||||
QTest::newRow("resolve1-3") << "netscape.com" << "173.194.70.0" << "255.255.255.0" << false;
|
||||
QTest::newRow("resolve1-4") << "mozilla.com" << "173.194.70.0" << "255.255.255.0" << false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user