Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3244765
D5184.id17049.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
D5184.id17049.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
@@ -244,6 +244,44 @@
item.getSessionID());
}
+TEST_F(DatabaseManagerTest, UpdateNotifTokenInDeviceSessionItem) {
+ const database::DeviceSessionItem item(
+ "bc0c1aa2-bf09-11ec-9d64-0242ac120002",
+ "mobile:"
+ "EMQNoQ7b2ueEmQ4QsevRWlXxFCNt055y20T1PHdoYAQRt0S6TLzZWNM6XSvdWqxm",
+ "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9Q9wodsQdZNynbTnC35hA4mFW"
+ "mwZf9BhbI93aGAwPF9au0eYsawRz0jtYi4lSFXC9KleyQDg+6J+UW1kiWvE3ZRYG"
+ "ECqgx4zqajPTzVt7EAOGaIh/dPyQ6x2Ul1GlkkSYXUhhixEzExGp9g84eCyVkbCB"
+ "U3SK6SNKyR7anAXDVQIDAQAB",
+ "hbI93aGAwPF9au0eYsawRz0jtYi4lSFXC9KleyQDg+6J+UW1kiWvE3",
+ "phone",
+ "ios:1.1.1",
+ "iOS 99.99.99");
+ EXPECT_EQ(
+ database::DatabaseManager::getInstance().isTableAvailable(
+ item.getTableName()),
+ true);
+ database::DatabaseManager::getInstance().putSessionItem(item);
+ std::shared_ptr<database::DeviceSessionItem> foundItem =
+ database::DatabaseManager::getInstance().findSessionItem(
+ item.getSessionID());
+ EXPECT_NE(foundItem, nullptr);
+ EXPECT_EQ(foundItem->getNotifyToken(), item.getNotifyToken());
+
+ const std::string newToken =
+ "HDVRgx4zqajPTzVt7EAOGaIh/dPyQ6x2Ul1GlkkSYXUhhixEzExGp9g84eCyVGHT";
+ database::DatabaseManager::getInstance().updateSessionItemDeviceToken(
+ item.getSessionID(), newToken);
+
+ foundItem = database::DatabaseManager::getInstance().findSessionItem(
+ item.getSessionID());
+ EXPECT_NE(foundItem, nullptr);
+ EXPECT_EQ(foundItem->getNotifyToken(), newToken);
+
+ database::DatabaseManager::getInstance().removeSessionItem(
+ item.getSessionID());
+}
+
TEST_F(DatabaseManagerTest, PutAndFoundSessionSignItemStaticDataIsSame) {
const database::SessionSignItem item(
"bB3OSLdKlY60KPBpw6VoGKX7Lmw3SA07FmNhnqnclvVeaxXueAQ0dpQSpiQTtlGn",
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 2:43 PM (21 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2494574
Default Alt Text
D5184.id17049.diff (2 KB)
Attached To
Mode
D5184: [services] Tunnelbroker - Add test for `updateSessionItemDeviceToken` database method
Attached
Detach File
Event Timeline
Log In to Comment