未验证 提交 4303d0b5 编写于 作者: O openharmony_ci 提交者: Gitee

!4796 【账号】修改测试用例中硬编码问题

Merge pull request !4796 from 何海涛/0804HardCode
...@@ -28,6 +28,8 @@ export default function ActsOsAccountThirdPartyTest_third_2() { ...@@ -28,6 +28,8 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
it('ActsOsAccountGetIdFormUid_0100', 0, async function (done) { it('ActsOsAccountGetIdFormUid_0100', 0, async function (done) {
console.debug("====>ActsOsAccountGetIdFormUid_0100 start===="); console.debug("====>ActsOsAccountGetIdFormUid_0100 start====");
var osAccountManager = osaccount.getAccountManager(); var osAccountManager = osaccount.getAccountManager();
var testLocalId = await osAccountManager.getOsAccountLocalIdFromProcess();
console.debug("====>testLocalId:" + testLocalId)
console.debug("====>get AccountManager finish===="); console.debug("====>get AccountManager finish====");
var bundleName = "com.example.actsosaccountthirdpartytest"; var bundleName = "com.example.actsosaccountthirdpartytest";
var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES); var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
...@@ -37,7 +39,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { ...@@ -37,7 +39,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>get localId err: " + JSON.stringify(err));
console.debug("====>localId obtained by uid:" + localId); console.debug("====>localId obtained by uid:" + localId);
expect(err).assertEqual(undefined); expect(err).assertEqual(undefined);
expect(localId).assertEqual(100); expect(localId).assertEqual(testLocalId);
console.debug("====>ActsOsAccountGetIdFormUid_0100 end===="); console.debug("====>ActsOsAccountGetIdFormUid_0100 end====");
done(); done();
}); });
...@@ -51,6 +53,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { ...@@ -51,6 +53,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
it('ActsOsAccountGetIdFormUid_0200', 0, async function (done) { it('ActsOsAccountGetIdFormUid_0200', 0, async function (done) {
console.debug("====>ActsOsAccountGetIdFormUid_0200 start===="); console.debug("====>ActsOsAccountGetIdFormUid_0200 start====");
var osAccountManager = osaccount.getAccountManager(); var osAccountManager = osaccount.getAccountManager();
var testLocalId = await osAccountManager.getOsAccountLocalIdFromProcess();
console.debug("====>get AccountManager finish===="); console.debug("====>get AccountManager finish====");
var bundleName = "com.example.actsosaccountthirdpartytest"; var bundleName = "com.example.actsosaccountthirdpartytest";
var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES); var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
...@@ -58,7 +61,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { ...@@ -58,7 +61,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
console.debug("====>obtained uid:" + uid); console.debug("====>obtained uid:" + uid);
var localId = await osAccountManager.getOsAccountLocalIdFromUid(uid); var localId = await osAccountManager.getOsAccountLocalIdFromUid(uid);
console.debug("====>localId obtained by uid:" + localId); console.debug("====>localId obtained by uid:" + localId);
expect(localId).assertEqual(100); expect(localId).assertEqual(testLocalId);
console.debug("====>ActsOsAccountGetIdFormUid_0200 end===="); console.debug("====>ActsOsAccountGetIdFormUid_0200 end====");
done(); done();
}); });
...@@ -151,12 +154,16 @@ export default function ActsOsAccountThirdPartyTest_third_2() { ...@@ -151,12 +154,16 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
it('ActsOsAccountGetIdFormProcess_0100', 0, async function (done) { it('ActsOsAccountGetIdFormProcess_0100', 0, async function (done) {
console.debug("====>ActsOsAccountGetIdFormProcess_0100 start===="); console.debug("====>ActsOsAccountGetIdFormProcess_0100 start====");
var osAccountManager = osaccount.getAccountManager(); var osAccountManager = osaccount.getAccountManager();
var bundleName = "com.example.actsosaccountthirdpartytest";
var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
var uid = bundleInfo.uid;
var testLocalId = await osAccountManager.getOsAccountLocalIdFromUid(uid)
console.debug("====>get AccountManager finish===="); console.debug("====>get AccountManager finish====");
osAccountManager.getOsAccountLocalIdFromProcess((err, localId)=>{ osAccountManager.getOsAccountLocalIdFromProcess((err, localId)=>{
console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>get localId err: " + JSON.stringify(err));
console.debug("====>localId obtained by process:" + localId); console.debug("====>localId obtained by process:" + localId);
expect(err).assertEqual(undefined); expect(err).assertEqual(undefined);
expect(localId).assertEqual(100); expect(localId).assertEqual(testLocalId);
console.debug("====>ActsOsAccountGetIdFormProcess_0100 end===="); console.debug("====>ActsOsAccountGetIdFormProcess_0100 end====");
done(); done();
}); });
...@@ -170,10 +177,15 @@ export default function ActsOsAccountThirdPartyTest_third_2() { ...@@ -170,10 +177,15 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
it('ActsOsAccountGetIdFormProcess_0200', 0, async function (done) { it('ActsOsAccountGetIdFormProcess_0200', 0, async function (done) {
console.debug("====>ActsOsAccountGetIdFormProcess_0200 start===="); console.debug("====>ActsOsAccountGetIdFormProcess_0200 start====");
var osAccountManager = osaccount.getAccountManager(); var osAccountManager = osaccount.getAccountManager();
var bundleName = "com.example.actsosaccountthirdpartytest";
var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
var uid = bundleInfo.uid;
var testLocalId = await osAccountManager.getOsAccountLocalIdFromUid(uid)
console.debug("====>testLocalId obtained by process:" + testLocalId)
console.debug("====>get AccountManager finish===="); console.debug("====>get AccountManager finish====");
var localId = await osAccountManager.getOsAccountLocalIdFromProcess(); var localId = await osAccountManager.getOsAccountLocalIdFromProcess();
console.debug("====>localId obtained by process:" + localId); console.debug("====>localId obtained by process:" + localId);
expect(localId).assertEqual(100); expect(localId).assertEqual(testLocalId);
console.debug("====>ActsOsAccountGetIdFormProcess_0200 end===="); console.debug("====>ActsOsAccountGetIdFormProcess_0200 end====");
done(); done();
}); });
...@@ -221,6 +233,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { ...@@ -221,6 +233,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
it('ActsOsAccountLocalIdSerial_0100', 0, async function (done) { it('ActsOsAccountLocalIdSerial_0100', 0, async function (done) {
console.debug("====>ActsOsAccountLocalIdSerial_0100 start===="); console.debug("====>ActsOsAccountLocalIdSerial_0100 start====");
var osAccountManager = osaccount.getAccountManager(); var osAccountManager = osaccount.getAccountManager();
var testLocalId = await osAccountManager.getOsAccountLocalIdFromProcess();
console.debug("====>get AccountManager finish===="); console.debug("====>get AccountManager finish====");
osAccountManager.getSerialNumberByOsAccountLocalId(100, (err, serialNumber)=>{ osAccountManager.getSerialNumberByOsAccountLocalId(100, (err, serialNumber)=>{
console.debug("====>ger serialNumber err:" + JSON.stringify(err)); console.debug("====>ger serialNumber err:" + JSON.stringify(err));
...@@ -234,7 +247,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { ...@@ -234,7 +247,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
console.debug("====>ger localId err:" + JSON.stringify(err)); console.debug("====>ger localId err:" + JSON.stringify(err));
console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber); console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber);
expect(err).assertEqual(undefined); expect(err).assertEqual(undefined);
expect(localId).assertEqual(100); expect(localId).assertEqual(testLocalId);
console.debug("====>ActsOsAccountLocalIdSerial_0100 end===="); console.debug("====>ActsOsAccountLocalIdSerial_0100 end====");
done(); done();
}) })
...@@ -249,8 +262,9 @@ export default function ActsOsAccountThirdPartyTest_third_2() { ...@@ -249,8 +262,9 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
it('ActsOsAccountLocalIdSerial_0200', 0, async function (done) { it('ActsOsAccountLocalIdSerial_0200', 0, async function (done) {
console.debug("====>ActsOsAccountLocalIdSerial_0200 start===="); console.debug("====>ActsOsAccountLocalIdSerial_0200 start====");
var osAccountManager = osaccount.getAccountManager(); var osAccountManager = osaccount.getAccountManager();
var testLocalId = await osAccountManager.getOsAccountLocalIdFromProcess();
console.debug("====>get AccountManager finish===="); console.debug("====>get AccountManager finish====");
var serialNumber = await osAccountManager.getSerialNumberByOsAccountLocalId(100); var serialNumber = await osAccountManager.getSerialNumberByOsAccountLocalId(testLocalId);
console.debug("====>get serialNumber:" + serialNumber + " by localId: 100" ); console.debug("====>get serialNumber:" + serialNumber + " by localId: 100" );
var serialNumberStr = serialNumber.toString(); var serialNumberStr = serialNumber.toString();
var serialIntercept = serialNumberStr.substring(8); var serialIntercept = serialNumberStr.substring(8);
...@@ -258,7 +272,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { ...@@ -258,7 +272,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
expect(serialIntercept).assertEqual("00000001"); expect(serialIntercept).assertEqual("00000001");
var localId = await osAccountManager.getOsAccountLocalIdBySerialNumber(serialNumber); var localId = await osAccountManager.getOsAccountLocalIdBySerialNumber(serialNumber);
console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber); console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber);
expect(localId).assertEqual(100); expect(localId).assertEqual(testLocalId);
console.debug("====>ActsOsAccountLocalIdSerial_0200 end===="); console.debug("====>ActsOsAccountLocalIdSerial_0200 end====");
done(); done();
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册