Backport some v3 certificate API unittest to v2 API

This patch add some v3 certificate API unittest into V2 API to improve
V2 API unittesting.

Change-Id: Icf58abbf1e83636047c1f98ff80a38077e2d694b
Merge "Backport some v3 certificate API unittest to v2 API"