diff --git a/services/tunnelbroker/test/DatabaseManagerTest.cpp b/services/tunnelbroker/test/DatabaseManagerTest.cpp --- a/services/tunnelbroker/test/DatabaseManagerTest.cpp +++ b/services/tunnelbroker/test/DatabaseManagerTest.cpp @@ -22,3 +22,21 @@ Aws::ShutdownAPI({}); } }; + +TEST_F(DatabaseManagerTest, TestOperationsOnPublicKeyItem) { + const database::PublicKeyItem item( + "mobile:" + tools::generateRandomString(DEVICEID_CHAR_LENGTH), + tools::generateRandomString(451)); + EXPECT_EQ( + database::DatabaseManager::getInstance().isTableAvailable( + item.getTableName()), + true); + database::DatabaseManager::getInstance().putPublicKeyItem(item); + std::shared_ptr foundItem = + database::DatabaseManager::getInstance().findPublicKeyItem( + item.getDeviceID()); + EXPECT_NE(foundItem, nullptr); + EXPECT_EQ(item.getPublicKey(), foundItem->getPublicKey()); + database::DatabaseManager::getInstance().removePublicKeyItem( + item.getDeviceID()); +}