param is now functional
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
NADAL Jean-Baptiste
2020-02-20 11:53:47 +01:00
parent d0646de38a
commit 17687d6836
3 changed files with 11 additions and 71 deletions

View File

@@ -32,14 +32,14 @@
#define kerror_body "{\"status\":\"error\"}"
#define ksuccess_put_param1 "{ \"id\": 1 }"
#define ksuccess_put_param2 "{ \"id\":\"1977\",\"action\":\"todo\" }"
#define ksuccess_put_param2 "{ \"year\": 1977, \"action\": \"todo\" }"
#define kserver_port "7777"
#define kapi_test_get "/api/v1/test_get"
#define kapi_test_put_id1 "/api/v1/test_put/:id"
#define kapi_test_put_id1_body "/api/v1/test_put/1"
#define kapi_test_put_id2 "/api/v1/test_put/:id/todo"
#define kapi_test_put_id2 "/api/v1/test_put/:year/todo"
#define kapi_test_put_id2_body "/api/v1/test_put/1977/todo"
#define kpost_method "POST"
@@ -227,7 +227,7 @@ int exec_request(const char *request, const char *path, int expected_code, const
{
res = strcmp(expected_body, resp_body);
}
// printf ("body: %s != expected_body: %s\n", resp_body, expected_body);
//printf ("body: %s != expected_body: %s\n", resp_body, expected_body);
if (res != 0)
{
ret = 2;
@@ -518,9 +518,13 @@ TEST("Rest - create start access to rest hook with params free\t")
sleep(1);
PRINTLN("\n - Param1");
//PRINTLN("\n - Param1");
ret = exec_request(kput_method, "http://localhost:" kserver_port kapi_test_put_id1_body, 200, "", ksuccess_put_param1);
ASSERT_EQUAL_INT(ret, 0);
//PRINTLN("\n - Param2");
ret = exec_request(kput_method, "http://localhost:" kserver_port kapi_test_put_id2_body, 200, "", ksuccess_put_param2);
ASSERT_EQUAL_INT(ret, 0);
restd_server_free(rest_server);
}