From fb447b94e369114df0bc96b5c4c20b2cd102bff0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 28 Apr 2018 10:44:11 +0200 Subject: Add decryption (and caching) of data, even when adding encryption key after data has been added --- tests/main.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/main.cpp b/tests/main.cpp index af3cf8d..7e8f489 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -143,19 +143,26 @@ int main() // TODO: Setup local bootstrap node for tests Database database("bootstrap.ring.cx", 4222, "storage"); - database.setOnCreateNodeCallback([](const DatabaseCreateNodeRequest &request) + int createNodeCounter = 0; + int addDataCounter = 0; + int addUserCounter = 0; + + database.setOnCreateNodeCallback([&createNodeCounter](const DatabaseCreateNodeRequest &request) { Log::debug("Create node callback"); + ++createNodeCounter; }); - database.setOnAddNodeCallback([](const DatabaseAddNodeRequest &request) + database.setOnAddNodeCallback([&addDataCounter](const DatabaseAddNodeRequest &request) { Log::debug("Add node callback"); + ++addDataCounter; }); - database.setOnAddUserCallback([](const DatabaseAddUserRequest &request) + database.setOnAddUserCallback([&addUserCounter](const DatabaseAddUserRequest &request) { Log::debug("Add user callback"); + ++addUserCounter; }); auto databaseCreateResponse = database.create("adminUserName", "latenight"); @@ -174,5 +181,9 @@ int main() this_thread::sleep_for(10ms); } + assertEquals(1, createNodeCounter); + assertEquals(2, addDataCounter); + assertEquals(1, addUserCounter); + return 0; } -- cgit v1.2.3