提交 3b8e77a4 编写于 作者: L lichenchen

账号错误码更新,xts用例预期结果同步修改

Signed-off-by: Nlichenchen <lichenchen15@huawei.com>
上级 db256754
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
"package": "com.example.actsaccountoperatetest", "package": "com.example.actsaccountoperatetest",
"name": ".MyApplication", "name": ".MyApplication",
"deviceType": [ "deviceType": [
"phone" "tablet",
"default"
], ],
"distro": { "distro": {
"deliveryWithInstall": true, "deliveryWithInstall": true,
......
...@@ -17,6 +17,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from ...@@ -17,6 +17,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
const TIMEOUT = 5000; const TIMEOUT = 5000;
const EACHTIMEOUT = 500; const EACHTIMEOUT = 500;
const ERR_JS_CREDENTIAL_NOT_EXIST = 12300102;
export default function ActsAppAccountCredential() { export default function ActsAppAccountCredential() {
describe('ActsAppAccountCredential', function () { describe('ActsAppAccountCredential', function () {
function sleep(delay) { function sleep(delay) {
...@@ -458,7 +459,7 @@ export default function ActsAppAccountCredential() { ...@@ -458,7 +459,7 @@ export default function ActsAppAccountCredential() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
appAccountManager.getCredential("account_name_1500", "credentialType15", (err)=>{ appAccountManager.getCredential("account_name_1500", "credentialType15", (err)=>{
console.debug("====>getCredential ActsAppAccountCredential_1500 err:" + JSON.stringify(err)); console.debug("====>getCredential ActsAppAccountCredential_1500 err:" + JSON.stringify(err));
expect(err.code == 12300019).assertEqual(true); expect(err.code == ERR_JS_CREDENTIAL_NOT_EXIST).assertEqual(true);
appAccountManager.removeAccount("account_name_1500", (err)=>{ appAccountManager.removeAccount("account_name_1500", (err)=>{
console.debug("====>delete Account ActsAppAccountCredential_1500 err:" + JSON.stringify(err)); console.debug("====>delete Account ActsAppAccountCredential_1500 err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
...@@ -485,7 +486,7 @@ export default function ActsAppAccountCredential() { ...@@ -485,7 +486,7 @@ export default function ActsAppAccountCredential() {
} }
catch(err){ catch(err){
console.debug("====>getCredential ActsAppAccountCredential_1600 err:" + JSON.stringify(err)); console.debug("====>getCredential ActsAppAccountCredential_1600 err:" + JSON.stringify(err));
expect(err.code == 12300019).assertEqual(true); expect(err.code == ERR_JS_CREDENTIAL_NOT_EXIST).assertEqual(true);
console.debug("====>delete account ActsAppAccountCredential_1600 start===="); console.debug("====>delete account ActsAppAccountCredential_1600 start====");
await appAccountManager.removeAccount("account_name_1600"); await appAccountManager.removeAccount("account_name_1600");
console.debug("====>ActsAppAccountCredential_1600 end===="); console.debug("====>ActsAppAccountCredential_1600 end====");
......
...@@ -25,7 +25,7 @@ const LENGTHLIMIT = 512; ...@@ -25,7 +25,7 @@ const LENGTHLIMIT = 512;
const TOKENLENGTHLIMIT = 1024; const TOKENLENGTHLIMIT = 1024;
const AUTHTYPELENGTHLIMIT = 1024; const AUTHTYPELENGTHLIMIT = 1024;
const OWNERLENGTHLIMIT = 1024; const OWNERLENGTHLIMIT = 1024;
const ERR_JS_AUTH_TYPE_NOT_FOUND = 12300107;
const OWNERSELF = "com.example.actsaccountoperatetest"; const OWNERSELF = "com.example.actsaccountoperatetest";
export default function ActsAccountAuthToken() { export default function ActsAccountAuthToken() {
describe('ActsAccountAuthToken', function () { describe('ActsAccountAuthToken', function () {
...@@ -1335,7 +1335,7 @@ export default function ActsAccountAuthToken() { ...@@ -1335,7 +1335,7 @@ export default function ActsAccountAuthToken() {
await appAccountManager.deleteAuthToken("account_promise_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token"); await appAccountManager.deleteAuthToken("account_promise_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token");
}catch(err){ }catch(err){
console.debug("====>deleteAuthToken second ActsAccountAuthToken_2200 err:" + JSON.stringify(err)); console.debug("====>deleteAuthToken second ActsAccountAuthToken_2200 err:" + JSON.stringify(err));
expect(err.code == 12400004).assertEqual(true); expect(err.code == ERR_JS_AUTH_TYPE_NOT_FOUND).assertEqual(true);
} }
try{ try{
console.debug("====>getAuthToken ActsAccountAuthToken_2200 start===="); console.debug("====>getAuthToken ActsAccountAuthToken_2200 start====");
......
...@@ -33,8 +33,9 @@ export default function ActsAccountAppAccess() { ...@@ -33,8 +33,9 @@ export default function ActsAccountAppAccess() {
console.info(`sleep #{time} over ...`) console.info(`sleep #{time} over ...`)
}) })
} }
beforeAll(async function (done) { beforeAll(async function (done) {
await featureAbility.startAbility( console.debug("====>ActsAccountAuthenticator beforeAll start====");
await featureAbility.startAbilityForResult(
{ {
want: want:
{ {
...@@ -47,7 +48,8 @@ export default function ActsAccountAppAccess() { ...@@ -47,7 +48,8 @@ export default function ActsAccountAppAccess() {
}, },
}, },
) )
await sleep(1500) await sleep(1500);
console.debug("====>ActsAccountAuthenticator beforeAll end====");
done(); done();
}); });
beforeEach(async (done)=>{ beforeEach(async (done)=>{
...@@ -619,7 +621,9 @@ export default function ActsAccountAppAccess() { ...@@ -619,7 +621,9 @@ export default function ActsAccountAppAccess() {
expect(data.length).assertEqual(1) expect(data.length).assertEqual(1)
} catch(err) { } catch(err) {
console.debug("====>ActsAccountSelectAccountByOptions_0100 err:" + JSON.stringify(err)); console.debug("====>ActsAccountSelectAccountByOptions_0100 err:" + JSON.stringify(err));
await appAccountManager.removeAccount(name);
expect(err).assertEqual(null) expect(err).assertEqual(null)
done();
} }
try{ try{
await appAccountManager.removeAccount(name) await appAccountManager.removeAccount(name)
...@@ -654,7 +658,9 @@ export default function ActsAccountAppAccess() { ...@@ -654,7 +658,9 @@ export default function ActsAccountAppAccess() {
expect(data.length).assertEqual(3) expect(data.length).assertEqual(3)
} catch(err) { } catch(err) {
console.debug("====>ActsAccountSelectAccountByOptions_0200 err:" + JSON.stringify(err)); console.debug("====>ActsAccountSelectAccountByOptions_0200 err:" + JSON.stringify(err));
await appAccountManager.removeAccount(name);
expect(err).assertEqual(null) expect(err).assertEqual(null)
done();
} }
try{ try{
await appAccountManager.removeAccount(name) await appAccountManager.removeAccount(name)
...@@ -690,7 +696,9 @@ export default function ActsAccountAppAccess() { ...@@ -690,7 +696,9 @@ export default function ActsAccountAppAccess() {
expect(data.length).assertEqual(1) expect(data.length).assertEqual(1)
} catch(err) { } catch(err) {
console.debug("====>ActsAccountSelectAccountByOptions_0300 err:" + JSON.stringify(err)); console.debug("====>ActsAccountSelectAccountByOptions_0300 err:" + JSON.stringify(err));
await appAccountManager.removeAccount(name);
expect(err).assertEqual(null) expect(err).assertEqual(null)
done();
} }
try{ try{
await appAccountManager.removeAccount(name) await appAccountManager.removeAccount(name)
......
...@@ -19,7 +19,7 @@ const NAMELIMIT = 512; ...@@ -19,7 +19,7 @@ const NAMELIMIT = 512;
const LENGTHLIMIT = 1024; const LENGTHLIMIT = 1024;
const ERR_PARAMETER_CHECK_FAILD =401 const ERR_PARAMETER_CHECK_FAILD =401
const ERR_INVALID_PARAMETER = 12300002 const ERR_INVALID_PARAMETER = 12300002
const ERR_ACCOUNT_EXIST = 12300008 const ERR_ACCOUNT_EXIST = 12300004
const createAccountOptions = {customData:{age:'12'}} //k and v length 1024 ,k and v size 1024 const createAccountOptions = {customData:{age:'12'}} //k and v length 1024 ,k and v size 1024
const createAccountOptionsDiff = {customData:{sex:'male'}} const createAccountOptionsDiff = {customData:{sex:'male'}}
export default function ActsAccountCreateAccount() { export default function ActsAccountCreateAccount() {
...@@ -521,7 +521,7 @@ export default function ActsAccountCreateAccount() { ...@@ -521,7 +521,7 @@ export default function ActsAccountCreateAccount() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
appAccountManager.createAccount("account_name_callback_same", createAccountOptionsDiff, (err)=>{ appAccountManager.createAccount("account_name_callback_same", createAccountOptionsDiff, (err)=>{
console.debug("====>add account second time ActsAccountCreateAccount_2300 err:" + JSON.stringify(err)); console.debug("====>add account second time ActsAccountCreateAccount_2300 err:" + JSON.stringify(err));
expect(err.code).assertEqual(12300008); expect(err.code).assertEqual(ERR_ACCOUNT_EXIST);
appAccountManager.removeAccount("account_name_callback_same", (err)=>{ appAccountManager.removeAccount("account_name_callback_same", (err)=>{
console.debug("====>delete Account ActsAccountCreateAccount_2300 err:" + JSON.stringify(err)); console.debug("====>delete Account ActsAccountCreateAccount_2300 err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
...@@ -548,7 +548,7 @@ export default function ActsAccountCreateAccount() { ...@@ -548,7 +548,7 @@ export default function ActsAccountCreateAccount() {
} }
catch(err){ catch(err){
console.debug("====>add account for the second time err:" + JSON.stringify(err)); console.debug("====>add account for the second time err:" + JSON.stringify(err));
expect(err.code).assertEqual(12300008); expect(err.code).assertEqual(ERR_ACCOUNT_EXIST);
appAccountManager.removeAccount("account_name_promise_same"); appAccountManager.removeAccount("account_name_promise_same");
console.debug("====>ActsAccountCreateAccount_2400 end===="); console.debug("====>ActsAccountCreateAccount_2400 end====");
done(); done();
......
...@@ -17,9 +17,8 @@ ...@@ -17,9 +17,8 @@
"package": "com.example.actsaccounttest", "package": "com.example.actsaccounttest",
"name": ".MyApplication", "name": ".MyApplication",
"deviceType": [ "deviceType": [
"tablet", "tablet",
"default", "default"
"phone"
], ],
"distro": { "distro": {
"deliveryWithInstall": true, "deliveryWithInstall": true,
......
...@@ -31,15 +31,15 @@ export default { ...@@ -31,15 +31,15 @@ export default {
await accountMgr.setAppAccess("zhangsan", "com.example.actsaccounttest", true); await accountMgr.setAppAccess("zhangsan", "com.example.actsaccounttest", true);
console.info('====>ServiceAbility setAppAccess actsaccountoperatetest zhangsan'); console.info('====>ServiceAbility setAppAccess actsaccountoperatetest zhangsan');
await accountMgr.setAppAccess("zhangsan", "com.example.actsaccountoperatetest", true); await accountMgr.setAppAccess("zhangsan", "com.example.actsaccountoperatetest", true);
console.info('====>ServiceAbility lcc addAccount 02 onStart'); console.info('====>ServiceAbility addAccount 02 onStart');
accountMgr.createAccount("lisi", async (err)=>{ accountMgr.createAccount("lisi", async (err)=>{
console.info('====>ServiceAbility setAppAccess actsaccounttest lisi'); console.info('====>ServiceAbility setAppAccess actsaccounttest lisi');
await accountMgr.setAppAccess("lisi", "com.example.actsaccounttest", true); await accountMgr.setAppAccess("lisi", "com.example.actsaccounttest", true);
console.info('====>ServiceAbility setAppAccess actsaccountoperatetest lisi'); console.info('====>ServiceAbility setAppAccess actsaccountoperatetest lisi');
await accountMgr.setAppAccess("lisi", "com.example.actsaccountoperatetest", true); await accountMgr.setAppAccess("lisi", "com.example.actsaccountoperatetest", true);
console.info('====>ServiceAbility lcc addAccount 03 onStart'); console.info('====>ServiceAbility addAccount 03 onStart');
accountMgr.createAccount("wangwu", async (err)=>{ accountMgr.createAccount("wangwu", async (err)=>{
console.info('====>ServiceAbility lcc enableAppAccess 03 onStart'); console.info('====>ServiceAbility enableAppAccess 03 onStart');
console.info('====>ServiceAbility setAppAccess actsaccounttest wangwu'); console.info('====>ServiceAbility setAppAccess actsaccounttest wangwu');
await accountMgr.setAppAccess("wangwu", "com.example.actsaccounttest", true) await accountMgr.setAppAccess("wangwu", "com.example.actsaccounttest", true)
console.info('====>ServiceAbility setAppAccess actsaccountoperatetest wangwu'); console.info('====>ServiceAbility setAppAccess actsaccountoperatetest wangwu');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册