diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2026-10-05 23:28:55 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2026-10-05 23:28:55 +0200 |
| commit | a436773a9f69182b799d88f75eb3cbe14d5d37a1 (patch) | |
| tree | fd6e0a30d6bda4a82b813e6601f0de4e229f4c5c /test_lib/transport.c | |
| parent | 28f36a2e69e13ee326d8bda50ad7a8df4e74d63a (diff) | |
| download | librm-a436773a9f69182b799d88f75eb3cbe14d5d37a1.tar.gz librm-a436773a9f69182b799d88f75eb3cbe14d5d37a1.zip | |
Authentication works
Diffstat (limited to 'test_lib/transport.c')
| -rw-r--r-- | test_lib/transport.c | 29 |
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; +} |
