diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2026-10-09 07:56:25 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2026-10-09 07:56:25 +0200 |
| commit | 0dacf7988513117da9b0935e658f9eca3ead09f7 (patch) | |
| tree | 95b2b7a35bd73dfe62755986749a872c253cd663 /test | |
| parent | a436773a9f69182b799d88f75eb3cbe14d5d37a1 (diff) | |
| download | librm-0dacf7988513117da9b0935e658f9eca3ead09f7.tar.gz librm-0dacf7988513117da9b0935e658f9eca3ead09f7.zip | |
Diffstat (limited to 'test')
| -rw-r--r-- | test/auth.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/test/auth.c b/test/auth.c index 1a31ae4..daf077b 100644 --- a/test/auth.c +++ b/test/auth.c @@ -12,12 +12,14 @@ int main() { nextResult = (struct ExpectedRequest[]) { { .url = "https://webapp-prod.cloud.remarkable.engineering/token/json/2/device/new", - .reqBody = "{\"code\": \"123456\",\"DeviceDesc\": \"librm\",\"DeviceId\": \"5E35708B-59B6-4715-A5D8-576C741D8276\"}", + .method = HTTP_POST, + .reqBody = "{\"code\": \"12345678\",\"DeviceDesc\": \"desktop-linux\",\"DeviceId\": \"5E35708B-59B6-4715-A5D8-576C741D8276\"}", .retBody = STATIC_SIZED_BLOCK("SomeDeviceToken"), .rc = RC_SUCCESS, }, { .url = "https://webapp-prod.cloud.remarkable.engineering/token/json/2/user/new", + .method = HTTP_POST, .token = "SomeDeviceToken", .reqBody = NULL, .retBody = STATIC_SIZED_BLOCK("SomeUserToken"), @@ -25,27 +27,34 @@ int main() { }, { .url = "https://internal.cloud.remarkable.com/sync/v4/root", + .method = HTTP_GET, .token = "SomeUserToken", .reqBody = NULL, .retBody = STATIC_SIZED_BLOCK("{\"hash\": \"0000000000000000000000000000000000000000000000000000000000000000\", \"generation\": 0}"), .rc = RC_SUCCESS, }, { - .url = "https://internal.cloud.remarkable.com/sync/v4/files/0000000000000000000000000000000000000000000000000000000000000000", + .url = "https://internal.cloud.remarkable.com/sync/v3/files/0000000000000000000000000000000000000000000000000000000000000000", + .method = HTTP_GET, .token = "SomeUserToken", + .filename = "root.docSchema", .reqBody = NULL, .retBody = STATIC_SIZED_BLOCK( - "3\n" + "4\n" + "0:.:1:0\n" "0000000000000000000000000000000000000000000000000000000000000001:CollectionType:someId:1:0\n" ), .rc = RC_SUCCESS, }, { - .url = "https://internal.cloud.remarkable.com/sync/v4/files/0000000000000000000000000000000000000000000000000000000000000001", + .url = "https://internal.cloud.remarkable.com/sync/v3/files/0000000000000000000000000000000000000000000000000000000000000001", + .method = HTTP_GET, .token = "SomeUserToken", + .filename = "someId", .reqBody = NULL, .retBody = STATIC_SIZED_BLOCK( - "3\n" + "4\n" + "0:.:1:0\n" "0000000000000000000000000000000000000000000000000000000000000002:DocumentType:someFileId:0:16\n" ), .rc = RC_SUCCESS, @@ -55,12 +64,14 @@ int main() { { enum ReturnCode rc; - char *code = "123456"; + char *code = "12345678"; struct RMDevice device = { .id = "5E35708B-59B6-4715-A5D8-576C741D8276", }; - rc = rm_device_open(&device, code); + rc = rm_device_enroll(&device, code); + assert(rc == RC_SUCCESS); + rc = rm_device_open(&device); assert(rc == RC_SUCCESS); struct RMDir dir = {}; @@ -106,17 +117,21 @@ int main() { nextResult = (struct ExpectedRequest[]) { { .url = "https://internal.cloud.remarkable.com/sync/v4/root", + .method = HTTP_GET, .token = "SomeUserToken", .reqBody = NULL, .retBody = STATIC_SIZED_BLOCK("{\"hash\": \"0000000000000000000000000000000000000000000000000000000000000000\", \"generation\": 1}"), .rc = RC_SUCCESS, }, { - .url = "https://internal.cloud.remarkable.com/sync/v4/files/0000000000000000000000000000000000000000000000000000000000000000", + .url = "https://internal.cloud.remarkable.com/sync/v3/files/0000000000000000000000000000000000000000000000000000000000000000", + .method = HTTP_GET, .token = "SomeUserToken", + .filename = "root.docSchema", .reqBody = NULL, .retBody = STATIC_SIZED_BLOCK( - "3\n" + "4\n" + "0:.:1:0\n" "0000000000000000000000000000000000000000000000000000000000000001:CollectionType:someId:1:0\n" ), .rc = RC_SUCCESS, @@ -130,7 +145,7 @@ int main() { .userToken = strdup("SomeUserToken"), .deviceToken = strdup("SomeDeviceToken"), }; - rc = rm_device_reopen(&device); + rc = rm_device_open(&device); assert(rc == RC_SUCCESS); assert(memcmp(device.root, "0000000000000000000000000000000000000000000000000000000000000000", sizeof(device.root)) == 0); |
