Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / unittest / provisioningmanager.cpp
1 /* *****************************************************************
2  *
3  * Copyright 2015 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * *****************************************************************/
20
21 #include "gtest/gtest.h"
22
23 #include "provisioningmanager.h"
24
25
26 static OicSecAcl_t acl;
27 SPTargetDeviceInfo_t list;
28 SPTargetDeviceInfo_t *ptr = &list;
29
30 TEST(SPProvisioningDiscoveryTest, NotNullList)
31 {
32     EXPECT_EQ(SP_RESULT_INVALID_PARAM, SPProvisioningDiscovery(0, &ptr));
33 }
34
35 TEST(SPInitProvisionContextTest, NullDeviceInfo)
36 {
37     EXPECT_EQ(SP_RESULT_INVALID_PARAM, SPInitProvisionContext(0, NULL));
38 }
39
40 TEST(SPProvisionACLTest, NullDeviceInfo)
41 {
42     EXPECT_EQ(SP_RESULT_INVALID_PARAM, SPProvisionACL(0, NULL, &acl));
43 }
44
45 TEST(SPFinalizeProvisioningTest, NullDeviceInfo)
46 {
47     EXPECT_EQ(SP_RESULT_INVALID_PARAM, SPFinalizeProvisioning(0, NULL));
48 }
49
50 TEST(SPTerminateProvisioningTest, ValidCase)
51 {
52     EXPECT_EQ(SP_RESULT_SUCCESS, SPTerminateProvisioning());
53 }
54
55 TEST(SPProvisionCredentialsTest, NullList)
56 {
57     EXPECT_EQ(SP_RESULT_INVALID_PARAM, SPProvisionCredentials(0, 0, NULL));
58 }