-# Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2020 - 2021 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
colour_log_formatter.cpp
../src/dcm-client/dcm_client.cpp
../src/dcm-client/device_certificate_manager.cpp
+ ../src/dcm-client/device_certificate_manager_ext.cpp
../src/shared/log.cpp
../src/shared/protobuf_asio.cpp
${PROTO_SRCS}
#include <boost/algorithm/hex.hpp>
#include "device_certificate_manager.h"
+#include "device_certificate_manager_ext.h"
#include "test_macros.h"
BOOST_AUTO_TEST_SUITE(API_TEST)
free(signature);
}
+NEGATIVE_TEST_CASE(test06_dcm_ext_api_invalid_params_on_client_side)
+{
+ int ret = dcm_ext_call_api(NULL, NULL, 0, NULL, NULL);
+ BOOST_REQUIRE_EQUAL(ret, DCM_EXT_ERROR_INVALID_PARAMETER);
+}
+
+NEGATIVE_TEST_CASE(test07_dcm_ext_api_invalid_method_name)
+{
+ int ret = dcm_ext_call_api("method-not-existing", NULL, 0, NULL, NULL);
+ BOOST_REQUIRE_EQUAL(ret, DCM_EXT_ERROR_INVALID_PARAMETER);
+}
+
+NEGATIVE_TEST_CASE(test08_dcm_ext_api_no_privilege)
+{
+ int ret = dcm_ext_call_api("method-with-a-privilege-not-granted", NULL, 0, NULL, NULL);
+ BOOST_REQUIRE_EQUAL(ret, DCM_EXT_ERROR_PERMISSION_DENIED);
+}
+
+POSITIVE_TEST_CASE(test09_dcm_ext_api_normal_call)
+{
+ size_t out_size;
+ char* output = NULL;
+ int input = 5;
+ int ret = dcm_ext_call_api("square-int-method", (char*)&input, sizeof(input), &output , &out_size);
+ BOOST_REQUIRE_EQUAL(ret, DCM_EXT_ERROR_NONE);
+ BOOST_REQUIRE_EQUAL(out_size, sizeof(int));
+ BOOST_REQUIRE_EQUAL((int)(*output), 25);
+ free(output);
+}
+
BOOST_AUTO_TEST_SUITE_END()