aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/main.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/main.cpp b/tests/main.cpp
index 0218c8c..4d3bcc3 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -83,16 +83,20 @@ void testEncryption()
int main()
{
printf("Starting tests...\n");
- LocalUser *localUser = LocalUser::create(Signature::KeyPair(), "dec05eba");
+ LocalUser *localUser = LocalUser::create(Signature::KeyPair(), "dec05eba", nullptr);
testSignData(localUser);
testEncryption();
testHash();
// TODO: Setup local bootstrap node for tests
Database database("bootstrap.ring.cx", 4222, "storage");
- auto databaseCreateResponse = database.create("dec05eba", "latenight");
- const char *data = "hello, world!";
- database.add(databaseCreateResponse, DataView{ (void*)data, strlen(data) });
+ auto databaseCreateResponse = database.create("adminUserName", "latenight");
+ DatabaseNode databaseNode(databaseCreateResponse->getNodeEncryptionKey(), databaseCreateResponse->getRequestHash());
+ auto adminUser = (LocalUser*)databaseCreateResponse->getNodeAdminUser();
+ database.addData(databaseNode, adminUser, DataView{ (void*)"hello, world!", 13 });
+ database.addUserToGroup(databaseNode, adminUser, localUser->getName(), localUser->getPublicKey(), adminUser->getGroups()[0]);
+ localUser->addToGroup(adminUser->getGroups()[0]);
+ database.addData(databaseNode, localUser, DataView{ (void*)"hello, aaald!", 13 });
database.commit();
database.seed(databaseCreateResponse->getRequestHash(), databaseCreateResponse->getNodeEncryptionKey());