domo update rest server to new API
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
NADAL Jean-Baptiste
2020-02-21 11:37:32 +01:00
parent db0c855300
commit a5521f05f1
8 changed files with 209 additions and 119 deletions

75
src/tests/test_domo.c Normal file
View File

@@ -0,0 +1,75 @@
/*!
* test_domo.c
*
* Copyright (c) 2015-2020, NADAL Jean-Baptiste. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*
* @Author: NADAL Jean-Baptiste
* @Date: 21/02/2020
*
*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
TEST("Domo - Server - Create Free\t")
{
restd_server_t *rest_server;
rest_server = restd_server_new();
ASSERT_NOT_NULL(rest_server);
restd_server_free(rest_server);
}
/*--------------------------------------------------------------------------*/
TEST("Domo - Test API correct access\t")
{
struct event_base *ev_base;
restd_server_t *rest_server;
devices_manager_t *dm;
char *config_path;
int ret;
dm = devices_manager_new();
ASSERT_NOT_NULL(dm);
ev_base = event_base_new();
ASSERT_NOT_NULL(ev_base);
rest_server = restd_server_new();
ASSERT_NOT_NULL(rest_server);
ret = restd_server_attach_event_loop(rest_server, ev_base);
ASSERT_EQUAL_INT(ret, 0);
config_path = get_config_path();
ASSERT_NOT_NULL(config_path);
ret = setup_rest_server(rest_server, kserver_port, config_path, dm);
ASSERT_EQUAL_INT(ret, 0);
// TODO
restd_server_free(rest_server);
devices_manager_free(dm);
free(config_path);
}