Test outlet is now functional
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -142,36 +142,41 @@ TEST("Domo - Test API /api/v1/outlets - correct access\t")
|
||||
// Outlets
|
||||
|
||||
// Get All Devices. Should be empty.
|
||||
ret = exec_request(kget_method, "http://localhost:" kserver_port "/api/v1/capabilities", 200, "", k_device_list_empty, false);
|
||||
ret = exec_request(kget_method, "http://localhost:" kserver_port "/api/v1/outlets", 200, "", k_outlet_list_empty, false);
|
||||
ASSERT_EQUAL_INT(ret, 0);
|
||||
|
||||
// Create An Outlet. Should be empty.
|
||||
|
||||
ret = exec_request(kpost_method, "http://localhost:" kserver_port "/api/v1/outlets", 204, k_create_outlet_1, "", false);
|
||||
ASSERT_EQUAL_INT(ret, 0);
|
||||
|
||||
// Get All Devices. Should Contain One Device.
|
||||
|
||||
ret = exec_request(kget_method, "http://localhost:" kserver_port "/api/v1/outlets", 200, "", k_outlet_list_one_elem, false);
|
||||
ASSERT_EQUAL_INT(ret, 0);
|
||||
|
||||
// Create A second Outlet. Should Contain two Device.
|
||||
ret = exec_request(kpost_method, "http://localhost:" kserver_port "/api/v1/outlets", 204, k_create_outlet_2, "", false);
|
||||
ASSERT_EQUAL_INT(ret, 0);
|
||||
|
||||
// Get All Devices. Should Contain two Devices.
|
||||
ret = exec_request(kget_method, "http://localhost:" kserver_port "/api/v1/outlets", 200, "", k_outlet_list_two_elem, false);
|
||||
ASSERT_EQUAL_INT(ret, 0);
|
||||
|
||||
// Update the second Outlet. Device should contain.
|
||||
ret = exec_request(kput_method, "http://localhost:" kserver_port "/api/v1/outlets/2", 204, k_update_outlet_2, "", false);
|
||||
ASSERT_EQUAL_INT(ret, 0);
|
||||
|
||||
// Get Device 2 only. Should Contain Device two updated.
|
||||
ret = exec_request(kget_method, "http://localhost:" kserver_port "/api/v1/outlets/2", 200, "", k_outlet_list_elem_2, false);
|
||||
ASSERT_EQUAL_INT(ret, 0);
|
||||
|
||||
// Delete Device 2.
|
||||
|
||||
ret = exec_request(kdelete_method, "http://localhost:" kserver_port "/api/v1/outlets/2", 204, "", "", false);
|
||||
ASSERT_EQUAL_INT(ret, 0);
|
||||
|
||||
// Get All Devices. Should Contain One Device.
|
||||
ret = exec_request(kget_method, "http://localhost:" kserver_port "/api/v1/outlets", 200, "", k_outlet_list_one_elem, false);
|
||||
ASSERT_EQUAL_INT(ret, 0);
|
||||
|
||||
restd_server_free(rest_server);
|
||||
devices_manager_free(dm);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Outlets
|
||||
restd_server_register_hook_on_path(rest_server, EVHTTP_REQ_POST, "/api/v1/outlets", outlet_create_handler, dm);
|
||||
restd_server_register_hook_on_path(rest_server, EVHTTP_REQ_GET, "/api/v1/outlets", outlet_list_handler, dm);
|
||||
restd_server_register_hook_on_path(rest_server, EVHTTP_REQ_GET, "/api/v1/outlets/:id", outlet_get_handler, dm);
|
||||
restd_server_register_hook_on_path(rest_server, EVHTTP_REQ_PUT, "/api/v1/outlets/:id", outlet_update_handler, dm);
|
||||
restd_server_register_hook_on_path(rest_server, EVHTTP_REQ_DELETE, "/api/v1/outlets/:id", outlet_remove_handler, dm);
|
||||
#endif
|
||||
Reference in New Issue
Block a user