From 4248e10cd6b28bb08eda7728ef6b92aa8705c6f5 Mon Sep 17 00:00:00 2001 From: "js126.lee" Date: Tue, 21 Mar 2017 13:27:13 +0900 Subject: [PATCH] [IOT-1846] Resolved unittest failure on provisioning Resolved unittest failure of SRPSaveTrustCertChainDER and SRPSaveTrustCertChainPEM. Change-Id: I9252c6718da1fa0be5942f296b391c49b7905c5f Signed-off-by: js126.lee Reviewed-on: https://gerrit.iotivity.org/gerrit/18035 Tested-by: jenkins-iotivity Reviewed-by: Randeep Singh --- .../provisioning/unittest/secureresourceprovider.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/resource/csdk/security/provisioning/unittest/secureresourceprovider.cpp b/resource/csdk/security/provisioning/unittest/secureresourceprovider.cpp index 81b38e8..9419132 100644 --- a/resource/csdk/security/provisioning/unittest/secureresourceprovider.cpp +++ b/resource/csdk/security/provisioning/unittest/secureresourceprovider.cpp @@ -206,10 +206,14 @@ public: SetPersistentHandler(&ps); OCStackResult res = OCRegisterPersistentStorageHandler(&ps); ASSERT_TRUE(res == OC_STACK_OK); + res = OCInit(NULL, 0, OC_SERVER); + ASSERT_TRUE(res == OC_STACK_OK); } static void TearDownTestCase() { + OCStackResult res = OCStop(); + ASSERT_TRUE(res == OC_STACK_OK); } static const ByteArray g_caPublicKey; @@ -265,25 +269,21 @@ static uint8_t keyData[] = { 0x3d, 0x96, 0x23, 0xe2, 0x24, 0x64, 0x98, 0x63, 0x21, 0xba, 0x02, 0x21 }; -// Disabled since always fails due to IOT-1846 -TEST_F(SRPTest, DISABLED_SRPSaveTrustCertChainDER) +TEST_F(SRPTest, SRPSaveTrustCertChainDER) { int result; uint16_t credId; result = SRPSaveTrustCertChain(certData, sizeof(certData), OIC_ENCODING_DER, &credId); - EXPECT_EQ(OC_STACK_OK, result); } -// Disabled since always fails due to IOT-1846 -TEST_F(SRPTest, DISABLED_SRPSaveTrustCertChainPEM) +TEST_F(SRPTest, SRPSaveTrustCertChainPEM) { int result; uint16_t credId; result = SRPSaveTrustCertChain(certData, sizeof(certData), OIC_ENCODING_PEM, &credId); - EXPECT_EQ(OC_STACK_OK, result); } @@ -318,10 +318,9 @@ TEST_F(SRPTest, SRPSaveOwnCertChainTest) key.data = keyData; key.len = sizeof(keyData); - //This test case cannot succeed. because doxm resource has not been initialized. result = SRPSaveOwnCertChain(&cert, &key, &credId); - EXPECT_EQ(OC_STACK_ERROR, result); + EXPECT_EQ(OC_STACK_OK, result); } TEST_F(SRPTest, SRPSaveOwnCertChainTestNullCert) -- 2.7.4