Commit 046248a9 authored by Martin Kampas's avatar Martin Kampas

ut_urlresolver: add checkVerifyResponse()

parent 355c4c03
......@@ -6,6 +6,7 @@
*/
#include "urlresolvertest.h"
#include "constants.h"
#include "testutils/process.h"
void UrlResolverTest::initTestCase(){
......@@ -294,3 +295,31 @@ void UrlResolverTest::checkStoreAuthorizedKeys(){
QFile::ReadOther | QFile::WriteOther | QFile::ExeOther;
QVERIFY((QFileInfo(QDir::home().filePath(".ssh")).permissions() & go_rwx) == 0);
}
void UrlResolverTest::checkVerifyResponse(){
QDomDocument doc("foo");
QDomElement root = doc.createElement("foo");
doc.appendChild(root);
QDomElement action = doc.createElement("action");
root.appendChild(action);
action.appendChild(doc.createTextNode("register"));
QDomElement deviceId = doc.createElement("deviceId");
root.appendChild(deviceId);
deviceId.appendChild(doc.createTextNode("deadbeef-dead-beef-dead"));
QDomElement protocolVersion = doc.createElement("protocolVersion");
root.appendChild(protocolVersion);
QDomText protocolVersionText = doc.createTextNode(SSU_PROTOCOL_VERSION);
protocolVersion.appendChild(protocolVersionText);
QVERIFY(ssu.verifyResponse(&doc));
protocolVersionText.setData(SSU_PROTOCOL_VERSION ".invalid");
QVERIFY2(!ssu.verifyResponse(&doc),
"Ssu::verifyResponse() should fail when protocolVersion does not match SSU_PROTOCOL_VERSION");
}
......@@ -29,6 +29,7 @@ class UrlResolverTest: public QObject {
void checkRegisterDevice();
void checkSetCredentials();
void checkStoreAuthorizedKeys();
void checkVerifyResponse();
private:
Ssu ssu;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment