Type was missing for identity packages
Added a test for it
This commit is contained in:
parent
9a0d110769
commit
39550ff6ea
3 changed files with 12 additions and 0 deletions
|
@ -136,6 +136,7 @@ void NetworkPackage::createIdentityPackage(NetworkPackage* np)
|
||||||
KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnectrc");
|
KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnectrc");
|
||||||
QString id = config->group("myself").readEntry<QString>("id","");
|
QString id = config->group("myself").readEntry<QString>("id","");
|
||||||
np->mId = QString::number(QDateTime::currentMSecsSinceEpoch());
|
np->mId = QString::number(QDateTime::currentMSecsSinceEpoch());
|
||||||
|
np->mType = PACKAGE_TYPE_IDENTITY;
|
||||||
np->set("deviceId", id);
|
np->set("deviceId", id);
|
||||||
np->set("deviceName", QHostInfo::localHostName());
|
np->set("deviceName", QHostInfo::localHostName());
|
||||||
np->set("protocolVersion", NetworkPackage::ProtocolVersion);
|
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()
|
void NetworkPackageTests::networkPackageEncryptionTest()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ private Q_SLOTS:
|
||||||
|
|
||||||
void dummyTest();
|
void dummyTest();
|
||||||
void networkPackageTest();
|
void networkPackageTest();
|
||||||
|
void networkPackageIdentityTest();
|
||||||
void networkPackageEncryptionTest();
|
void networkPackageEncryptionTest();
|
||||||
|
|
||||||
void cleanupTestCase();
|
void cleanupTestCase();
|
||||||
|
|
Loading…
Reference in a new issue