[IOT-1846] Resolved unittest failure on provisioning
authorjs126.lee <js126.lee@samsung.com>
Tue, 21 Mar 2017 04:27:13 +0000 (13:27 +0900)
committerRandeep Singh <randeep.s@samsung.com>
Fri, 24 Mar 2017 04:55:05 +0000 (04:55 +0000)
Resolved unittest failure of SRPSaveTrustCertChainDER and SRPSaveTrustCertChainPEM.

Change-Id: I9252c6718da1fa0be5942f296b391c49b7905c5f
Signed-off-by: js126.lee <js126.lee@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18035
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
resource/csdk/security/provisioning/unittest/secureresourceprovider.cpp

index 81b38e8..9419132 100644 (file)
@@ -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)