Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3393851
D3687.id11548.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3687.id11548.diff
View Options
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,43 @@
Aws::ShutdownAPI({});
}
};
+
+TEST_F(DatabaseManagerTest, TestOperationsOnSessionSignItem) {
+ const database::SessionSignItem item(
+ "bB3OSLdKlY60KPBpw6VoGKX7Lmw3SA07FmNhnqnclvVeaxXueAQ0dpQSpiQTtlGn",
+ "mobile:EMQNoQ7b2ueEmQ4QsevRWlXxFCNt055y20T1PHdoYAQRt0S6TLzZWNM6XSvdWqxm";
+ EXPECT_EQ(
+ database::DatabaseManager::getInstance().isTableAvailable(
+ item.getTableName()),
+ true);
+ database::DatabaseManager::getInstance().putSessionSignItem(item);
+ std::shared_ptr<database::SessionSignItem> foundItem =
+ database::DatabaseManager::getInstance().findSessionSignItem(
+ item.getDeviceID());
+ EXPECT_NE(foundItem, nullptr);
+ EXPECT_EQ(item.getSign(), foundItem->getSign());
+ database::DatabaseManager::getInstance().removeSessionSignItem(
+ item.getDeviceID());
+}
+
+TEST_F(DatabaseManagerTest, TestOperationsOnSessionSignItemGenerated) {
+ const database::SessionSignItem item(
+ tools::generateRandomString(SIGNATURE_REQUEST_LENGTH),
+ "mobile:" + tools::generateRandomString(DEVICEID_CHAR_LENGTH));
+ EXPECT_EQ(
+ database::DatabaseManager::getInstance().isTableAvailable(
+ item.getTableName()),
+ true);
+ database::DatabaseManager::getInstance().putSessionSignItem(item);
+ std::shared_ptr<database::SessionSignItem> foundItem =
+ database::DatabaseManager::getInstance().findSessionSignItem(
+ item.getDeviceID());
+ EXPECT_NE(foundItem, nullptr) << "Item with the key of deviceID \""
+ << item.getDeviceID() << "\" is not found";
+ EXPECT_EQ(item.getSign(), foundItem->getSign())
+ << "Generated signature value \"" << item.getSign()
+ << "\" is not equal of \"" + foundItem->getSign() +
+ "\" from the database value";
+ database::DatabaseManager::getInstance().removeSessionSignItem(
+ item.getDeviceID());
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 4:14 PM (21 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605504
Default Alt Text
D3687.id11548.diff (2 KB)
Attached To
Mode
D3687: [services] Tunnelbroker - Database SessionSignatureItem tests
Attached
Detach File
Event Timeline
Log In to Comment