未验证 提交 3c70ecf2 编写于 作者: O openharmony_ci 提交者: Gitee

!4463 增加enterpriseAdmin枚举测试用例

Merge pull request !4463 from junyi233/cherry-pick-1658389243
......@@ -23,6 +23,7 @@ const BUNDLE_NAME3 = 'com.example.third1';
const ABILITY_NAME1 = "ExtensionAbility1";
const ABILITY_NAME2 = "noexitAbility";
const ABILITY_NAME3 = "ServiceAbility";
const ABILITY_NAME4 = "EnterpriseAdminAbility";
let userId = 0;
export default function QueryExtensionAbilityInfos() {
......@@ -782,14 +783,15 @@ export default function QueryExtensionAbilityInfos() {
*/
it('SUB_BMS_APPINFO_EXTENSION_0020', 0, async function (done) {
await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_EXTENSION_ABILITY).then(data => {
expect(data.extensionAbilityInfo.length).assertEqual(7);
expect(data.extensionAbilityInfo.length).assertEqual(8);
expect(data.extensionAbilityInfo[0].name).assertEqual("ExtensionAbilityA");
expect(data.extensionAbilityInfo[1].name).assertEqual("ExtensionAbilityB");
expect(data.extensionAbilityInfo[2].name).assertEqual("ExtensionAbilityQ");
expect(data.extensionAbilityInfo[3].name).assertEqual("ExtensionAbilityW");
expect(data.extensionAbilityInfo[4].name).assertEqual("ExtensionAbility1");
expect(data.extensionAbilityInfo[5].name).assertEqual("FormAbility");
expect(data.extensionAbilityInfo[6].name).assertEqual("ServiceAbility");
expect(data.extensionAbilityInfo[4].name).assertEqual("EnterpriseAdminAbility");
expect(data.extensionAbilityInfo[5].name).assertEqual("ExtensionAbility1");
expect(data.extensionAbilityInfo[6].name).assertEqual("FormAbility");
expect(data.extensionAbilityInfo[7].name).assertEqual("ServiceAbility");
}).catch(err => {
expect(err).assertFail();
});
......@@ -799,14 +801,15 @@ export default function QueryExtensionAbilityInfos() {
done();
return;
}
expect(data.extensionAbilityInfo.length).assertEqual(7);
expect(data.extensionAbilityInfo.length).assertEqual(8);
expect(data.extensionAbilityInfo[0].name).assertEqual("ExtensionAbilityA");
expect(data.extensionAbilityInfo[1].name).assertEqual("ExtensionAbilityB");
expect(data.extensionAbilityInfo[2].name).assertEqual("ExtensionAbilityQ");
expect(data.extensionAbilityInfo[3].name).assertEqual("ExtensionAbilityW");
expect(data.extensionAbilityInfo[4].name).assertEqual("ExtensionAbility1");
expect(data.extensionAbilityInfo[5].name).assertEqual("FormAbility");
expect(data.extensionAbilityInfo[6].name).assertEqual("ServiceAbility");
expect(data.extensionAbilityInfo[4].name).assertEqual("EnterpriseAdminAbility");
expect(data.extensionAbilityInfo[5].name).assertEqual("ExtensionAbility1");
expect(data.extensionAbilityInfo[6].name).assertEqual("FormAbility");
expect(data.extensionAbilityInfo[7].name).assertEqual("ServiceAbility");
done();
})
})
......@@ -833,6 +836,62 @@ export default function QueryExtensionAbilityInfos() {
})
})
/*
* @tc.number: SUB_BMS_APPINFO_EXTENSION_0022
* @tc.name: test queryExtensionAbilityInfos api
* @tc.desc: test queryExtensionAbilityInfos get enterpriseAdmin extensionAbility
*/
it('SUB_BMS_APPINFO_EXTENSION_0022', 0, async function (done) {
await bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME4
}, bundle.ExtensionAbilityType.ENTERPRISE_ADMIN, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT,
userId).then(data => {
expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage");
expect(data[0].moduleName).assertEqual("phone");
expect(data[0].name).assertEqual(ABILITY_NAME4);
expect(data[0].labelId).assertLarger(0);
expect(data[0].descriptionId).assertLarger(0);
expect(data[0].iconId).assertEqual(0);
expect(data[0].isVisible).assertFalse();
expect(data[0].extensionAbilityType).assertEqual(11);
expect(data[0].permissions.length).assertEqual(0);
expect(data[0].enabled).assertTrue();
expect(data[0].readPermission).assertEqual("");
expect(data[0].writePermission).assertEqual("");
expect(data[0].metadata.length).assertEqual(0);
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.queryExtensionAbilityInfos(
{
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME4
}, bundle.ExtensionAbilityType.ENTERPRISE_ADMIN, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT,
userId, (err, data) => {
if (err) {
expect(err).assertEqual(1);
done();
return;
}
expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage");
expect(data[0].moduleName).assertEqual("phone");
expect(data[0].name).assertEqual(ABILITY_NAME4);
expect(data[0].labelId).assertLarger(0);
expect(data[0].descriptionId).assertLarger(0);
expect(data[0].iconId).assertEqual(0);
expect(data[0].isVisible).assertFalse();
expect(data[0].extensionAbilityType).assertEqual(11);
expect(data[0].permissions.length).assertEqual(0);
expect(data[0].enabled).assertTrue();
expect(data[0].readPermission).assertEqual("");
expect(data[0].writePermission).assertEqual("");
expect(data[0].metadata.length).assertEqual(0);
done();
})
})
function checkApplication(data) {
expect(data[0].applicationInfo.name).assertEqual("ohos.acts.bundle.stage");
expect(data[0].applicationInfo.codePath).assertEqual("/data/app/el1/bundle/public/ohos.acts.bundle.stage");
......
......@@ -219,6 +219,19 @@
"resource": "$profile:form_config"
}
]
},
{
"name": "EnterpriseAdminAbility",
"srcEntrance": "./ets/ServiceAbility/FormAbility.ts",
"label": "$string:form_FormAbility_label",
"description": "$string:form_FormAbility_desc",
"type": "enterpriseAdmin",
"metadata": [
{
"name": "ohos.extension.form",
"resource": "$profile:form_config"
}
]
}
]
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册