summaryrefslogtreecommitdiffstats
path: root/test_lib/transport.c
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2026-10-05 23:28:55 +0200
committerJesper Jensen <jesper@jnsn.dev>2026-10-05 23:28:55 +0200
commita436773a9f69182b799d88f75eb3cbe14d5d37a1 (patch)
treefd6e0a30d6bda4a82b813e6601f0de4e229f4c5c /test_lib/transport.c
parent28f36a2e69e13ee326d8bda50ad7a8df4e74d63a (diff)
downloadlibrm-a436773a9f69182b799d88f75eb3cbe14d5d37a1.tar.gz
librm-a436773a9f69182b799d88f75eb3cbe14d5d37a1.zip
Authentication works
Diffstat (limited to 'test_lib/transport.c')
-rw-r--r--test_lib/transport.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/test_lib/transport.c b/test_lib/transport.c
new file mode 100644
index 0000000..004bace
--- /dev/null
+++ b/test_lib/transport.c
@@ -0,0 +1,29 @@
+#include "transport_test.h"
+#include <assert.h>
+
+struct ExpectedRequest *nextResult = NULL;
+
+enum ReturnCode transport_request(char *url, enum HttpMethod method, char *token, char *reqBody, struct SizedBlock *retBody) {
+ assert(nextResult != NULL);
+ assert(strcmp(nextResult->url, url) == 0);
+ if(nextResult->reqBody == NULL) {
+ assert(nextResult->reqBody == NULL);
+ } else {
+ assert(reqBody != NULL);
+ assert(strcmp(nextResult->reqBody, reqBody) == 0);
+ }
+
+ if(nextResult->token == NULL) {
+ assert(nextResult->token == NULL);
+ } else {
+ assert(token != NULL);
+ assert(strcmp(nextResult->token, token) == 0);
+ }
+
+
+ memcpy(retBody, &nextResult->retBody, sizeof(struct SizedBlock));
+
+ enum ReturnCode rc = nextResult->rc;
+ nextResult++;
+ return rc;
+}