summaryrefslogtreecommitdiff
path: root/tests/capi/test_suite_02.cpp
diff options
context:
space:
mode:
authorKyungwook Tak <k.tak@samsung.com>2015-07-13 10:43:23 +0900
committerKyungwook Tak <k.tak@samsung.com>2015-07-16 18:08:33 +0900
commitb854e72692792825c7d905df13eac186e73a1d2d (patch)
treecc22bc9ffed5f6b15c321c150667b2a47f9b1ad5 /tests/capi/test_suite_02.cpp
parentee8181dce4bc0f6c38db8b43c5f1ea0c021cc8d4 (diff)
downloadcert-svc-b854e72692792825c7d905df13eac186e73a1d2d.tar.gz
cert-svc-b854e72692792825c7d905df13eac186e73a1d2d.tar.bz2
cert-svc-b854e72692792825c7d905df13eac186e73a1d2d.zip
Update Tizen 2.4 latest codes
* remove dpl dependency (to wrt-commons) * cert-server service added, which is moved from secure-storage * add test codes - turn test build flag on in spec file to build test cases Change-Id: Id355e0e52220dd2b281a1a2225383fd366b876fe Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
Diffstat (limited to 'tests/capi/test_suite_02.cpp')
-rw-r--r--tests/capi/test_suite_02.cpp83
1 files changed, 83 insertions, 0 deletions
diff --git a/tests/capi/test_suite_02.cpp b/tests/capi/test_suite_02.cpp
new file mode 100644
index 0000000..e01fbb7
--- /dev/null
+++ b/tests/capi/test_suite_02.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2011 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.
+ * 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 <string>
+
+#include <openssl/x509.h>
+
+#include <dpl/test/test_runner.h>
+#include <dpl/log/log.h>
+#include <memory>
+
+#include <api_tests.h>
+
+#include <cert-service.h>
+
+RUNNER_TEST_GROUP_INIT(DEPRECATED_API)
+
+typedef std::unique_ptr<CERT_CONTEXT, std::function<int(CERT_CONTEXT*)>> ScopedCertCtx;
+
+/*
+ * author: ---
+ * test: PEM positive.
+ * description: Loading *.pem file.
+ * expect: *.pem should load with no error.
+ */
+RUNNER_TEST(deprecated_api_test01_pem_positive)
+{
+ ScopedCertCtx ctx(cert_svc_cert_context_init(), cert_svc_cert_context_final);
+ RUNNER_ASSERT(CERT_SVC_ERR_NO_ERROR ==
+ cert_svc_load_file_to_context(ctx.get(), "/usr/share/cert-svc/cert-type/cert0.pem"));
+}
+
+/*
+ * author: ---
+ * test: DER positive.
+ * description: Loading *.der file.
+ * expect: *.der file should load with no error.
+ */
+RUNNER_TEST(deprecated_api_test02_der_positive)
+{
+ ScopedCertCtx ctx(cert_svc_cert_context_init(), cert_svc_cert_context_final);
+ RUNNER_ASSERT(CERT_SVC_ERR_NO_ERROR ==
+ cert_svc_load_file_to_context(ctx.get(), "/usr/share/cert-svc/cert-type/cert1.der"));
+}
+
+/*
+ * author: ---
+ * test: PEM negative.
+ * description: Loading *.pem file.
+ * expect: *.pom file should not load and return error.
+ */
+RUNNER_TEST(deprecated_api_test03_pem_negative)
+{
+ ScopedCertCtx ctx(cert_svc_cert_context_init(), cert_svc_cert_context_final);
+ RUNNER_ASSERT(CERT_SVC_ERR_NO_ERROR !=
+ cert_svc_load_file_to_context(ctx.get(), "/usr/share/cert-svc/cert-type/cert2fake.pem"));
+}
+
+/*
+ * author: ---
+ * test: DER negative.
+ * description: Loading *.der file.
+ * expect: *.der file should not load and return error.
+ */
+RUNNER_TEST(deprecated_api_test03_der_negative)
+{
+ ScopedCertCtx ctx(cert_svc_cert_context_init(), cert_svc_cert_context_final);
+ RUNNER_ASSERT(CERT_SVC_ERR_NO_ERROR !=
+ cert_svc_load_file_to_context(ctx.get(), "/usr/share/cert-svc/cert-type/cert3fake.der"));
+}
+