未验证 提交 97cb8b3b 编写于 作者: O openharmony_ci 提交者: Gitee

!3545 新增校验fingerprint字段的xts用例

Merge pull request !3545 from 耿文广/master
...@@ -35,6 +35,7 @@ const BUNDLE_OTHER = 'com.example.third1'; ...@@ -35,6 +35,7 @@ const BUNDLE_OTHER = 'com.example.third1';
const BUNDLE_NOTEXIST = 'com.ohos.package'; const BUNDLE_NOTEXIST = 'com.ohos.package';
const FLAG_DEFAULT = Bundle.BundleFlag.GET_BUNDLE_DEFAULT; const FLAG_DEFAULT = Bundle.BundleFlag.GET_BUNDLE_DEFAULT;
const PATH = "/data/app/el1/bundle/public"; const PATH = "/data/app/el1/bundle/public";
const TEST_DEMO = "8E93863FC32EE238060BF69A9B37E2608FFFB21F93C862DD511CBAC9F30024B5";
let userId = 0; let userId = 0;
export default function applicationBundleJsunit() { export default function applicationBundleJsunit() {
...@@ -388,6 +389,35 @@ export default function applicationBundleJsunit() { ...@@ -388,6 +389,35 @@ export default function applicationBundleJsunit() {
}); });
}); });
/**
* @tc.number: getApplicationInfo_1800
* @tc.name: getApplicationInfo : Obtains based on a given bundle name and flag.
* @tc.desc: Check whether fingerprint gets
*/
it('getApplicationInfo_1800', 0, async function (done) {
await Bundle.getApplicationInfo(BUNDLE_NAME,
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_CERTIFICATE_FINGERPRINT).then((data) => {
expect(data.fingerprint).assertEqual(TEST_DEMO);
}).catch((error) => {
expect(error).assertFail();
});
done()
});
/**
* @tc.number: getApplicationInfo_1900
* @tc.name: getApplicationInfo : Obtains based on a given bundle name and flag.
* @tc.desc: Check whether fingerprint gets
*/
it('getApplicationInfo_1900', 0, async function (done) {
Bundle.getApplicationInfo(BUNDLE_NAME,
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_CERTIFICATE_FINGERPRINT, (error, data) => {
expect(data.fingerprint).assertEqual(TEST_DEMO);
expect(error).assertEqual(0);
done();
});
});
function expectData(msg, data) { function expectData(msg, data) {
expect(typeof (data)).assertEqual('object'); expect(typeof (data)).assertEqual('object');
expect(typeof (data.name)).assertEqual('string'); expect(typeof (data.name)).assertEqual('string');
...@@ -408,6 +438,7 @@ export default function applicationBundleJsunit() { ...@@ -408,6 +438,7 @@ export default function applicationBundleJsunit() {
expect(typeof (data.enabled)).assertEqual('boolean'); expect(typeof (data.enabled)).assertEqual('boolean');
expect(typeof (data.uid)).assertEqual('number'); expect(typeof (data.uid)).assertEqual('number');
expect(typeof (data.entityType)).assertEqual('string'); expect(typeof (data.entityType)).assertEqual('string');
expect(typeof (data.fingerprint)).assertEqual('string');
expect(typeof (data.removable)).assertEqual('boolean'); expect(typeof (data.removable)).assertEqual('boolean');
expect(Array.isArray(data.permissions)).assertEqual(true); expect(Array.isArray(data.permissions)).assertEqual(true);
expect(Array.isArray(data.moduleSourceDirs)).assertEqual(true); expect(Array.isArray(data.moduleSourceDirs)).assertEqual(true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册