Commit 39550ff6 authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Type was missing for identity packages

Added a test for it
parent 9a0d1107
......@@ -136,6 +136,7 @@ void NetworkPackage::createIdentityPackage(NetworkPackage* np)
KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnectrc");
QString id = config->group("myself").readEntry<QString>("id","");
np->mId = QString::number(QDateTime::currentMSecsSinceEpoch());
np->mType = PACKAGE_TYPE_IDENTITY;
np->set("deviceId", id);
np->set("deviceName", QHostInfo::localHostName());
np->set("protocolVersion", NetworkPackage::ProtocolVersion);
......
......@@ -79,6 +79,16 @@ void NetworkPackageTests::networkPackageTest()
}
void NetworkPackageTests::networkPackageIdentityTest()
{
NetworkPackage np("");
NetworkPackage::createIdentityPackage(&np);
QCOMPARE( np.get<int>("protocolVersion") , NetworkPackage::ProtocolVersion );
QCOMPARE( np.type() , PACKAGE_TYPE_IDENTITY );
}
void NetworkPackageTests::networkPackageEncryptionTest()
{
......
......@@ -32,6 +32,7 @@ private Q_SLOTS:
void dummyTest();
void networkPackageTest();
void networkPackageIdentityTest();
void networkPackageEncryptionTest();
void cleanupTestCase();
......
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