diff options
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; +} |
