提交 ba6c42d6 编写于 作者: R renyi

Bms test update cover userId

Signed-off-by: Nrenyi <ry.renyi@huawei.com>
上级 07e21563
......@@ -476,7 +476,6 @@ describe('ActsBundleManagerTest', function () {
for (var j = 0; j < datainfo.moduleInfos; j++) {
expect(datainfo.moduleInfos[j].moduleName).assertEqual("entry")
expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0)
}
}).catch(err => {
console.info("getApplicationInfo fail:" + JSON.stringify(err))
......@@ -1010,7 +1009,7 @@ describe('ActsBundleManagerTest', function () {
it('getBundleArchiveInfo_0900', 0, async function (done) {
await demo.getBundleArchiveInfo(PATH + ERROR, 1, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
if(err){
if (err) {
console.info("getBundleArchiveInfo error" + JSON.stringify(err));
expect(err).assertEqual(1);
done();
......@@ -1030,7 +1029,7 @@ describe('ActsBundleManagerTest', function () {
it('getBundleArchiveInfo_1000', 0, async function (done) {
await demo.getBundleArchiveInfo(' ', 1, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
if(err){
if (err) {
console.info("getBundleArchiveInfo error" + JSON.stringify(err));
expect(err).assertEqual(1);
done();
......@@ -1983,7 +1982,7 @@ describe('ActsBundleManagerTest', function () {
it('getBundleInfo_0900', 0, async function (done) {
await demo.getBundleInfo('error', demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
if (err){
if (err) {
console.info("getBundleInfo err" + JSON.stringify(err));
expect(err).assertEqual(1);
done();
......@@ -2043,7 +2042,7 @@ describe('ActsBundleManagerTest', function () {
await demo.getBundleInfo(' ', demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, OnReceiveEvent)
function OnReceiveEvent(err, datainfo) {
if (err){
if (err) {
console.info("getBundleInfo err" + JSON.stringify(err));
expect(err).assertEqual(1);
done();
......@@ -2062,7 +2061,7 @@ describe('ActsBundleManagerTest', function () {
*/
it('getApplicationInfo_0500', 0, async function (done) {
demo.getApplicationInfo('', demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, 0, (error, datainfo) => {
if (error){
if (error) {
console.info("getApplicationInfo err" + JSON.stringify(error));
expect(error).assertEqual(1);
done();
......@@ -2098,7 +2097,7 @@ describe('ActsBundleManagerTest', function () {
*/
it('getApplicationInfo_1000', 0, async function (done) {
demo.getApplicationInfo('', demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, 0, (error, datainfo) => {
if (error){
if (error) {
console.info("getApplicationInfo fail" + JSON.stringify(error));
expect(error).assertEqual(1);
done();
......@@ -2132,7 +2131,7 @@ describe('ActsBundleManagerTest', function () {
{
"bundleName": "com.example.myapplication1",
"abilityName": "com.example.myapplication1.MainAbility",
}, demo.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION|demo.BundleFlag.GET_ABILITY_INFO_WITH_PERMISSION, 0).then(data => {
}, demo.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | demo.BundleFlag.GET_ABILITY_INFO_WITH_PERMISSION, 0).then(data => {
expect(data.length).assertLarger(0);
for (let i = 0, len = data.length; i < len; i++) {
var datainfo = data[i];
......@@ -2373,6 +2372,222 @@ describe('ActsBundleManagerTest', function () {
})
/**
* @tc.number getBundleInfo_1400
* @tc.name BUNDLEMGR::getBundleInfo
* @tc.desc Test getBundleInfo interface with current userId(by promise).
*/
it('getBundleInfo_1400', 0, async function (done) {
let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST1], {
userId: 0,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
getInfo();
});
async function getInfo() {
var bundleOptions = {
userId: 0,
networkId: ""
};
var dataInfo = await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions);
expect(dataInfo.name).assertEqual(NAME1)
expect(dataInfo.vendor).assertEqual("example")
expect(dataInfo.versionCode).assertEqual(VERSIONCODE1)
expect(dataInfo.versionName).assertLarger(0)
expect(dataInfo.entryModuleName).assertEqual("entry")
expect(dataInfo.appInfo.name).assertEqual(NAME1)
expect(dataInfo.appInfo.description).assertEqual("$string:mainability_description")
expect(dataInfo.appInfo.descriptionId >= 0).assertTrue()
expect(dataInfo.appInfo.icon).assertEqual("$media:icon")
expect(dataInfo.appInfo.iconId >= 0).assertTrue()
expect(dataInfo.appInfo.label).assertEqual("$string:app_name")
expect(dataInfo.appInfo.labelId >= 0).assertTrue()
expect(dataInfo.appInfo.systemApp).assertEqual(true)
expect(dataInfo.appInfo.supportedModes).assertEqual(0)
expect(dataInfo.updateTime).assertLarger(0)
expect(dataInfo.reqPermissions.length).assertEqual(0)
expect(dataInfo.reqPermissionDetails.length).assertEqual(0)
expect(dataInfo.compatibleVersion).assertEqual(5)
expect(dataInfo.targetVersion).assertEqual(5)
expect(dataInfo.isCompressNativeLibs).assertEqual(false)
for (var s = 0; s < dataInfo.hapModuleInfo; s++) {
expect(dataInfo.moduleInfos[s].name).assertEqual("com.example.myapplication1")
expect(dataInfo.moduleInfos[s].moduleName).assertEqual("entry")
}
expect(dataInfo.entryModuleName).assertEqual("entry")
expect(dataInfo.isSilentInstallation.length).assertEqual(0)
expect(dataInfo.minCompatibleVersionCode).assertEqual(0)
expect(dataInfo.entryInstallationFree).assertEqual(false)
for (var j = 0; j < dataInfo.appInfo.moduleInfos; j++) {
expect(dataInfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry")
expect(dataInfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1)
}
expect(dataInfo.appInfo.enabled).assertEqual(true);
installData.uninstall(NAME1, {
userId: 0,
installFlag: 0,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
}
})
/**
* @tc.number getBundleInfo_1500
* @tc.name BUNDLE::getBundleInfo
* @tc.desc Test getBundleInfo interface with current userId(by callback).
*/
it('getBundleInfo_1500', 0, async function (done) {
let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST1], {
userId: 0,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
getInfo();
});
async function getInfo() {
var bundleOptions = {
userId: 0,
networkId: ""
};
demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions, (err, dataInfo) => {
expect(dataInfo.name).assertEqual(NAME1)
expect(dataInfo.vendor).assertEqual("example")
expect(dataInfo.versionCode).assertEqual(VERSIONCODE1)
expect(dataInfo.versionName).assertLarger(0)
expect(dataInfo.entryModuleName).assertEqual("entry")
expect(dataInfo.appInfo.name).assertEqual(NAME1)
expect(dataInfo.appInfo.description).assertEqual("$string:mainability_description")
expect(dataInfo.appInfo.descriptionId >= 0).assertTrue()
expect(dataInfo.appInfo.icon).assertEqual("$media:icon")
expect(dataInfo.appInfo.iconId >= 0).assertTrue()
expect(dataInfo.appInfo.label).assertEqual("$string:app_name")
expect(dataInfo.appInfo.labelId >= 0).assertTrue()
expect(dataInfo.appInfo.systemApp).assertEqual(true)
expect(dataInfo.appInfo.supportedModes).assertEqual(0)
expect(dataInfo.updateTime).assertLarger(0)
expect(dataInfo.reqPermissions.length).assertEqual(0)
expect(dataInfo.reqPermissionDetails.length).assertEqual(0)
expect(dataInfo.compatibleVersion).assertEqual(5)
expect(dataInfo.targetVersion).assertEqual(5)
expect(dataInfo.isCompressNativeLibs).assertEqual(false)
for (var s = 0; s < dataInfo.hapModuleInfo; s++) {
expect(dataInfo.moduleInfos[s].name).assertEqual("com.example.myapplication1")
expect(dataInfo.moduleInfos[s].moduleName).assertEqual("entry")
}
expect(dataInfo.entryModuleName).assertEqual("entry")
expect(dataInfo.isSilentInstallation.length).assertEqual(0)
expect(dataInfo.minCompatibleVersionCode).assertEqual(0)
expect(dataInfo.entryInstallationFree).assertEqual(false)
for (var j = 0; j < dataInfo.appInfo.moduleInfos; j++) {
expect(dataInfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry")
expect(dataInfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1)
}
expect(dataInfo.appInfo.enabled).assertEqual(true);
installData.uninstall(NAME1, {
userId: 0,
installFlag: 0,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
});
}
})
/**
* @tc.number getBundleInfo_1600
* @tc.name BUNDLEMGR::getBundleInfo
* @tc.desc Test getBundleInfo interface with other userId(by promise).
*/
it('getBundleInfo_1600', 0, async function (done) {
let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST1], {
userId: 0,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
getInfo();
});
async function getInfo() {
demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, {
userId: 1,
networkId: ""
}).then(data => {
expect().assertFail();
}).catch(err => {
expect(err).assertEqual(1);
installData.uninstall(NAME1, {
userId: 0,
installFlag: 0,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
});
}
})
/**
* @tc.number getBundleInfo_1700
* @tc.name BUNDLE::getBundleInfo
* @tc.desc Test getBundleInfo interface with other userId(by callback).
*/
it('getBundleInfo_1700', 0, async function (done) {
let installData = await demo.getBundleInstaller()
installData.install([PATH + BMSJSTEST1], {
userId: 0,
installFlag: 0,
isKeepData: false
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
getInfo();
});
async function getInfo() {
demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, {
userId: 1,
networkId: ""
}, (err, dataInfo) => {
expect(err).assertEqual(1);
expect(dataInfo).assertEqual(undefined);
installData.uninstall(NAME1, {
userId: 0,
installFlag: 0,
isKeepData: false
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
});
}
})
/**
* @tc.number queryAbilityByWant_1000
* @tc.name BUNDLE::queryAbilityByWant
......@@ -2403,7 +2618,7 @@ describe('ActsBundleManagerTest', function () {
installData.install([PATH + BMSJSTEST1], installParam, async (err, data) => {
expect(data.statusMessage).assertEqual("SUCCESS")
var datainfo = await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
console.info("getBundleInfo result"+JSON.stringify(datainfo))
console.info("getBundleInfo result" + JSON.stringify(datainfo))
expect(datainfo.name).assertEqual(NAME1);
installData.uninstall(NAME1, installParam, async (err, data) => {
expect(err.code).assertEqual(0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册