Commit 010440ea authored by Vitalii Irkha's avatar Vitalii Irkha Committed by Aleksey

Unittests extend coverage

Added certhelper coverage

Change-Id: I6b1a0882b0ba239f22b0eeded57d8c554944c3f0
Signed-off-by: default avatarVitalii Irkha <v.irkha@samsung.com>
parent bd03dadb
......@@ -21,6 +21,10 @@
#ifndef IOTVT_SRM_CERTHELPERS_H_
#define IOTVT_SRM_CERTHELPERS_H_
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__WITH_TLS__) || defined(__WITH_DTLS__)
#include <mbedtls/pk.h>
......@@ -125,4 +129,8 @@ OCStackResult OCInternalVerifyRoleCertificate(const OicSecKey_t *certificateChai
const ByteArrayLL_t *trustedCaCerts,
OicSecRole_t **roles, size_t *rolesLength,
struct tm *notValidAfter);
#ifdef __cplusplus
}
#endif
#endif
......@@ -105,7 +105,8 @@ unittests_src += [
'pbkdf2tests.cpp',
'srmtestcommon.cpp',
'crlresourcetest.cpp',
'ocsecurity.cpp'
'ocsecurity.cpp',
'certhelpers.cpp'
]
if target_os not in ['msys_nt', 'windows']:
......
/* *****************************************************************
*
* Copyright 2019 Samsung Electronics 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* *****************************************************************/
#include <gtest/gtest.h>
#include "octypes.h"
#include "csrresource.h"
#include "certhelpers.h"
using namespace std;
#define TAG "CERT-HLP-UT"
TEST(OCInternalGenerateKeyPairTest, InvalidPK)
{
EXPECT_EQ(-1, OCInternalGenerateKeyPair(NULL));
}
TEST(OCInternalIsValidCertChainTest, InvalidCertificateBuffer)
{
EXPECT_EQ(OC_STACK_INVALID_PARAM, OCInternalIsValidCertChain(NULL, 0));
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment