Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9c02dfe3
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9c02dfe3
编写于
1月 14, 2022
作者:
O
openharmony_ci
提交者:
Gitee
1月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1559 Update osaccount test code
Merge pull request !1559 from 高曦/master_account_0113
上级
7a1f070a
f51ba516
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
489 addition
and
244 deletion
+489
-244
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/Activate.test.js
...accountsystemtest/entry/src/main/js/test/Activate.test.js
+78
-54
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/OnOff.test.js
...sosaccountsystemtest/entry/src/main/js/test/OnOff.test.js
+3
-3
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/Query.test.js
...sosaccountsystemtest/entry/src/main/js/test/Query.test.js
+202
-66
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/test/OsAccountIs.test.js
...thirdpartytest/entry/src/main/js/test/OsAccountIs.test.js
+206
-121
未找到文件。
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/Activate.test.js
浏览文件 @
9c02dfe3
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
import
osaccount
from
'
@ohos.account.osAccount
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUT
=
1000
;
const
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
=
4587571
;
describe
(
'
ActsOsAccountSystemTest
'
,
function
()
{
describe
(
'
ActsOsAccountSystemTest
'
,
function
()
{
/*
/*
...
@@ -26,17 +28,29 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -26,17 +28,29 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountActivate_0100 start====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_0100 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
isOsAccountActived
(
100
,
(
err
,
data
)
=>
{
osAccountManager
.
isOsAccountActived
(
100
,
(
err
,
isActived
)
=>
{
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountActived data:
"
+
data
);
console
.
debug
(
"
====>isOsAccountActived data:
"
+
isActived
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertTrue
();
if
(
isActived
){
osAccountManager
.
activateOsAccount
(
100
,
(
err
)
=>
{
osAccountManager
.
activateOsAccount
(
100
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>activateOsAccount err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
);
console
.
debug
(
"
====>ActsOsAccountActivate_0100 end====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_0100 end====
"
);
done
();
done
();
})
})
}
else
{
osAccountManager
.
activateOsAccount
(
100
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount first err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
osAccountManager
.
activateOsAccount
(
100
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount second err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
);
console
.
debug
(
"
====>ActsOsAccountActivate_0100 end====
"
);
done
();
})
})
}
})
})
});
});
...
@@ -49,23 +63,29 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -49,23 +63,29 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountActivate_0200 start====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_0200 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
var
isActived
=
await
osAccountManager
.
isOsAccountActived
(
100
);
var
isActived
=
await
osAccountManager
.
isOsAccountActived
(
100
);
}
catch
(
err
){
console
.
error
(
"
====>catch isOsAccountActived 0200 err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
isActived
));
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
isActived
));
expect
(
isActived
).
assertTrue
();
if
(
isActived
){
try
{
try
{
await
osAccountManager
.
activateOsAccount
(
100
);
}
catch
(
err
){
console
.
debug
(
"
====>catch activateOsAccount 0200 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
);
console
.
debug
(
"
====>ActsOsAccountActivate_0200 end====
"
);
done
();
}
}
else
{
console
.
debug
(
"
====>switch to 100 user====
"
);
await
osAccountManager
.
activateOsAccount
(
100
);
await
osAccountManager
.
activateOsAccount
(
100
);
}
catch
(
err
){
try
{
console
.
debug
(
"
====>catch activateOsAccount 0200 err:
"
+
JSON
.
stringify
(
err
));
await
osAccountManager
.
activateOsAccount
(
100
);
expect
(
err
.
code
!=
0
).
assertTrue
();
}
catch
(
err
){
console
.
debug
(
"
====>ActsOsAccountActivate_0200 end====
"
);
console
.
debug
(
"
====>catch activateOsAccount 0200 err:
"
+
JSON
.
stringify
(
err
));
done
();
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
);
}
console
.
debug
(
"
====>ActsOsAccountActivate_0200 end====
"
);
done
();
}
}
});
});
/*
/*
...
@@ -158,7 +178,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -158,7 +178,7 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
0
,
(
err
)
=>
{
osAccountManager
.
activateOsAccount
(
0
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount to 0 user err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>activateOsAccount to 0 user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
(
);
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
);
console
.
debug
(
"
====>ActsOsAccountActivate_0500 end====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_0500 end====
"
);
done
();
done
();
})
})
...
@@ -177,7 +197,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -177,7 +197,7 @@ describe('ActsOsAccountSystemTest', function () {
await
osAccountManager
.
activateOsAccount
(
0
);
await
osAccountManager
.
activateOsAccount
(
0
);
}
catch
(
err
){
}
catch
(
err
){
console
.
debug
(
"
====>activateOsAccount to 0 user err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>activateOsAccount to 0 user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
(
);
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
);
console
.
debug
(
"
====>ActsOsAccountActivate_0600 end====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_0600 end====
"
);
done
();
done
();
}
}
...
@@ -194,7 +214,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -194,7 +214,7 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
-
1
,
(
err
)
=>
{
osAccountManager
.
activateOsAccount
(
-
1
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount to -1 user err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>activateOsAccount to -1 user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
(
);
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
);
console
.
debug
(
"
====>ActsOsAccountActivate_0700 end====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_0700 end====
"
);
done
();
done
();
})
})
...
@@ -213,7 +233,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -213,7 +233,7 @@ describe('ActsOsAccountSystemTest', function () {
await
osAccountManager
.
activateOsAccount
(
-
1
);
await
osAccountManager
.
activateOsAccount
(
-
1
);
}
catch
(
err
){
}
catch
(
err
){
console
.
debug
(
"
====>activateOsAccount to -1 user err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>activateOsAccount to -1 user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
(
);
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
);
console
.
debug
(
"
====>ActsOsAccountActivate_0800 end====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_0800 end====
"
);
done
();
done
();
}
}
...
@@ -228,12 +248,18 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -228,12 +248,18 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountActivate_0900 start====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_0900 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
"
Abc
"
,
(
err
)
=>
{
var
localIdStr
=
"
100
"
;
console
.
debug
(
"
====>activateOsAccount to 'Abc' user err:
"
+
JSON
.
stringify
(
err
));
function
funcActivateCallback
(
err
){
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>error received callback====
"
);
console
.
debug
(
"
====>receive activateOsAccount err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
osAccountManager
.
activateOsAccount
(
localIdStr
,
funcActivateCallback
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountActivate_0900 end====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_0900 end====
"
);
done
();
done
();
}
)
}
,
TIMEOUT
);
});
});
/*
/*
...
@@ -245,14 +271,11 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -245,14 +271,11 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountActivate_1000 start====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_1000 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
var
localIdStr
=
"
100
"
;
await
osAccountManager
.
activateOsAccount
(
"
Abc
"
);
var
activateResult
=
await
osAccountManager
.
activateOsAccount
(
localIdStr
);
}
catch
(
err
){
expect
(
activateResult
).
assertEqual
(
null
);
console
.
debug
(
"
====>activateOsAccount to 'Abc' user err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>ActsOsAccountActivate_1000 end====
"
);
expect
(
err
.
code
!=
0
).
assertTrue
();
done
();
console
.
debug
(
"
====>ActsOsAccountActivate_1000 end====
"
);
done
();
}
});
});
/*
/*
...
@@ -264,12 +287,17 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -264,12 +287,17 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountActivate_1100 start====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_1100 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
undefined
,
(
err
)
=>
{
function
funcActivateCallback
(
err
){
console
.
debug
(
"
====>activateOsAccount to undefined user err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>error received callback====
"
);
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>receive activateOsAccount err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
osAccountManager
.
activateOsAccount
(
undefined
,
funcActivateCallback
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountActivate_1100 end====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_1100 end====
"
);
done
();
done
();
}
)
}
,
TIMEOUT
);
});
});
/*
/*
...
@@ -281,14 +309,10 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -281,14 +309,10 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountActivate_1200 start====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_1200 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
var
activateResult
=
await
osAccountManager
.
activateOsAccount
(
undefined
);
await
osAccountManager
.
activateOsAccount
(
undefined
);
expect
(
activateResult
).
assertEqual
(
null
);
}
catch
(
err
){
console
.
debug
(
"
====>ActsOsAccountActivate_1200 end====
"
);
console
.
debug
(
"
====>activateOsAccount to undefined user err:
"
+
JSON
.
stringify
(
err
));
done
();
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_1200 end====
"
);
done
();
}
});
});
/*
/*
...
@@ -303,7 +327,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -303,7 +327,7 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
nonExistentLocalId
,
(
err
)
=>
{
osAccountManager
.
activateOsAccount
(
nonExistentLocalId
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount to nonexist user err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>activateOsAccount to nonexist user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
(
);
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
);
console
.
debug
(
"
====>ActsOsAccountActivate_1300 end====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_1300 end====
"
);
done
();
done
();
})
})
...
@@ -323,7 +347,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -323,7 +347,7 @@ describe('ActsOsAccountSystemTest', function () {
await
osAccountManager
.
activateOsAccount
(
nonExistentLocalId
);
await
osAccountManager
.
activateOsAccount
(
nonExistentLocalId
);
}
catch
(
err
){
}
catch
(
err
){
console
.
debug
(
"
====>activateOsAccount to nonexist user err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>activateOsAccount to nonexist user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
(
);
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
);
console
.
debug
(
"
====>ActsOsAccountActivate_1400 end====
"
);
console
.
debug
(
"
====>ActsOsAccountActivate_1400 end====
"
);
done
();
done
();
}
}
...
...
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/OnOff.test.js
浏览文件 @
9c02dfe3
...
@@ -245,7 +245,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -245,7 +245,7 @@ describe('ActsOsAccountSystemTest', function () {
/*
/*
* @tc.number : ActsOsAccountOnOff_0700
* @tc.number : ActsOsAccountOnOff_0700
* @tc.name : Subscribe and unsubscribing local multi-user
* @tc.name : Subscribe and unsubscribing local multi-user
* @tc.desc : V
erification cannot cancel activating type not subscribed
* @tc.desc : V
alidate subscription callback with parameter name as empty string
*/
*/
it
(
'
ActsOsAccountOnOff_0700
'
,
0
,
async
function
(
done
)
{
it
(
'
ActsOsAccountOnOff_0700
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountOnOff_0700 start====
"
);
console
.
debug
(
"
====>ActsOsAccountOnOff_0700 start====
"
);
...
@@ -269,7 +269,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -269,7 +269,7 @@ describe('ActsOsAccountSystemTest', function () {
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
osAccountInfo
.
localName
).
assertEqual
(
"
osAccountNameE
"
);
expect
(
osAccountInfo
.
localName
).
assertEqual
(
"
osAccountNameE
"
);
osAccountManager
.
activateOsAccount
(
localId
,
(
err
)
=>
{
osAccountManager
.
activateOsAccount
(
localId
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>activateOsAccount err
code
:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
err
.
code
).
assertEqual
(
0
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
osAccountManager
.
removeOsAccount
(
localId
,
(
err
)
=>
{
osAccountManager
.
removeOsAccount
(
localId
,
(
err
)
=>
{
...
@@ -286,7 +286,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -286,7 +286,7 @@ describe('ActsOsAccountSystemTest', function () {
/*
/*
* @tc.number : ActsOsAccountOnOff_0800
* @tc.number : ActsOsAccountOnOff_0800
* @tc.name : Subscribe and unsubscribing local multi-user
* @tc.name : Subscribe and unsubscribing local multi-user
* @tc.desc : V
erification cannot cancel activating type not subscribed
* @tc.desc : V
alidate subscription promise with parameter name as empty string
*/
*/
it
(
'
ActsOsAccountOnOff_0800
'
,
0
,
async
function
(
done
)
{
it
(
'
ActsOsAccountOnOff_0800
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountOnOff_0800 start====
"
);
console
.
debug
(
"
====>ActsOsAccountOnOff_0800 start====
"
);
...
...
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/Query.test.js
浏览文件 @
9c02dfe3
...
@@ -12,10 +12,12 @@
...
@@ -12,10 +12,12 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import
osaccount
from
'
@ohos.account.os
A
ccount
'
import
osaccount
from
'
@ohos.account.os
a
ccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUT
=
1000
;
const
OSACCOUNTMAXNUMBER
=
999
;
const
OSACCOUNTMAXNUMBER
=
999
;
const
ERR_OSACCOUNT_KIT_QUERY_OS_ACCOUNT_BY_ID_ERROR
=
4587554
;
describe
(
'
ActsOsAccountSystemTest
'
,
function
()
{
describe
(
'
ActsOsAccountSystemTest
'
,
function
()
{
/*
/*
...
@@ -68,15 +70,23 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -68,15 +70,23 @@ describe('ActsOsAccountSystemTest', function () {
/*
/*
* @tc.number : ActsOsAccountQuery_0300
* @tc.number : ActsOsAccountQuery_0300
* @tc.name : queryOsAccountById callback
* @tc.name : queryOsAccountById callback
* @tc.desc : Authenticate
failed to obtain local user 0 information
* @tc.desc : Authenticate
to get local user 0 information and compare
*/
*/
it
(
'
ActsOsAccountQuery_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
ActsOsAccountQuery_0300
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0300 start====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0300 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
queryOsAccountById
(
0
,
(
err
)
=>
{
osAccountManager
.
queryOsAccountById
(
0
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>queryOsAccountById data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
localId
).
assertEqual
(
0
);
expect
(
data
.
type
.
ADMIN
).
assertEqual
(
0
);
var
serialNumberStr
=
data
.
serialNumber
.
toString
();
var
serialIntercept
=
serialNumberStr
.
substring
(
8
);
console
.
debug
(
"
====>truncate the last eight characters:
"
+
serialIntercept
);
expect
(
serialIntercept
).
assertEqual
(
"
00000000
"
);
expect
(
data
.
isCreateCompleted
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountQuery_0300 end====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0300 end====
"
);
done
();
done
();
})
})
...
@@ -85,20 +95,23 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -85,20 +95,23 @@ describe('ActsOsAccountSystemTest', function () {
/*
/*
* @tc.number : ActsOsAccountQuery_0400
* @tc.number : ActsOsAccountQuery_0400
* @tc.name : queryOsAccountById promise
* @tc.name : queryOsAccountById promise
* @tc.desc : Authenticate
failed to obtain local user 0 information
* @tc.desc : Authenticate
to get local user 0 information and compare
*/
*/
it
(
'
ActsOsAccountQuery_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
ActsOsAccountQuery_0400
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0400 start====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0400 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
var
osAccountInfo
=
await
osAccountManager
.
queryOsAccountById
(
0
);
await
osAccountManager
.
queryOsAccountById
(
0
);
console
.
debug
(
"
====>queryOsAccountById osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
}
catch
(
err
){
expect
(
osAccountInfo
.
localId
).
assertEqual
(
0
);
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
osAccountInfo
.
type
.
ADMIN
).
assertEqual
(
0
);
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
var
serialNumberStr
=
osAccountInfo
.
serialNumber
.
toString
();
console
.
debug
(
"
====>ActsOsAccountQuery_0400 end====
"
);
var
serialIntercept
=
serialNumberStr
.
substring
(
8
);
done
();
console
.
debug
(
"
====>truncate the last eight characters:
"
+
serialIntercept
);
}
expect
(
serialIntercept
).
assertEqual
(
"
00000000
"
);
expect
(
osAccountInfo
.
isCreateCompleted
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountQuery_0400 end====
"
);
done
();
});
});
/*
/*
...
@@ -112,7 +125,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -112,7 +125,7 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
queryOsAccountById
(
-
1
,
(
err
)
=>
{
osAccountManager
.
queryOsAccountById
(
-
1
,
(
err
)
=>
{
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_QUERY_OS_ACCOUNT_BY_ID_ERROR
);
console
.
debug
(
"
====>ActsOsAccountQuery_0500 end====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0500 end====
"
);
done
();
done
();
})
})
...
@@ -121,7 +134,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -121,7 +134,7 @@ describe('ActsOsAccountSystemTest', function () {
/*
/*
* @tc.number : ActsOsAccountQuery_0600
* @tc.number : ActsOsAccountQuery_0600
* @tc.name : queryOsAccountById promise
* @tc.name : queryOsAccountById promise
* @tc.desc : Authenticate failed to obtain local user
0
information
* @tc.desc : Authenticate failed to obtain local user
-1
information
*/
*/
it
(
'
ActsOsAccountQuery_0600
'
,
0
,
async
function
(
done
)
{
it
(
'
ActsOsAccountQuery_0600
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0600 start====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0600 start====
"
);
...
@@ -131,7 +144,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -131,7 +144,7 @@ describe('ActsOsAccountSystemTest', function () {
await
osAccountManager
.
queryOsAccountById
(
-
1
);
await
osAccountManager
.
queryOsAccountById
(
-
1
);
}
catch
(
err
){
}
catch
(
err
){
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_QUERY_OS_ACCOUNT_BY_ID_ERROR
);
console
.
debug
(
"
====>ActsOsAccountQuery_0600 end====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0600 end====
"
);
done
();
done
();
}
}
...
@@ -146,12 +159,19 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -146,12 +159,19 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountQuery_0700 start====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0700 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
queryOsAccountById
(
"
100
"
,
(
err
)
=>
{
var
localIdStr
=
"
100
"
;
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
function
funcQueryById
(
err
,
data
){
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>error received callback====
"
);
console
.
debug
(
"
====>receive queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>receive queryOsAccountById data:
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}
osAccountManager
.
queryOsAccountById
(
localIdStr
,
funcQueryById
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountQuery_0700 end====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0700 end====
"
);
done
();
done
();
}
)
}
,
TIMEOUT
);
});
});
/*
/*
...
@@ -163,14 +183,12 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -163,14 +183,12 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountQuery_0800 start====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0800 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
var
localIdStr
=
"
100
"
;
await
osAccountManager
.
queryOsAccountById
(
"
100
"
);
var
osAccountInfo
=
await
osAccountManager
.
queryOsAccountById
(
localIdStr
);
}
catch
(
err
){
console
.
debug
(
"
====>get os accountInfo is:
"
+
osAccountInfo
);
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
osAccountInfo
).
assertEqual
(
null
);
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountQuery_0800 end====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0800 end====
"
);
done
();
done
();
}
});
});
/*
/*
...
@@ -182,12 +200,18 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -182,12 +200,18 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountQuery_0900 start====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0900 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
queryOsAccountById
(
undefined
,
(
err
)
=>
{
function
funcQueryById
(
err
,
data
){
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>error received callback====
"
);
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>receive queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>receive queryOsAccountById data:
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}
osAccountManager
.
queryOsAccountById
(
undefined
,
funcQueryById
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountQuery_0900 end====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_0900 end====
"
);
done
();
done
();
}
)
}
,
TIMEOUT
);
});
});
/*
/*
...
@@ -199,14 +223,11 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -199,14 +223,11 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountQuery_1000 start====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_1000 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
var
osAccountInfo
=
await
osAccountManager
.
queryOsAccountById
(
undefined
);
await
osAccountManager
.
queryOsAccountById
(
undefined
);
console
.
debug
(
"
====>get os accountInfo is:
"
+
osAccountInfo
);
}
catch
(
err
){
expect
(
osAccountInfo
).
assertEqual
(
null
);
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>ActsOsAccountQuery_1000 end====
"
);
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
done
();
console
.
debug
(
"
====>ActsOsAccountQuery_1000 end====
"
);
done
();
}
});
});
/*
/*
...
@@ -223,10 +244,12 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -223,10 +244,12 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>queryAllCreatedOsAccounts err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>queryAllCreatedOsAccounts err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>queryAllCreatedOsAccounts data:
"
+
JSON
.
stringify
(
data
));
console
.
debug
(
"
====>queryAllCreatedOsAccounts data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
err
.
code
).
assertEqual
(
0
);
console
.
debug
(
"
====>data.length:
"
+
data
.
length
);
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
dataMap
.
set
(
data
[
i
].
localId
,
data
[
i
].
localName
)
console
.
debug
(
"
====>contain localId:
"
+
data
[
i
].
localId
);
dataMap
.
set
(
data
[
i
].
localId
.
toString
(),
data
[
i
].
localName
)
}
}
expect
(
dataMap
.
has
(
100
)).
assertTrue
();
expect
(
dataMap
.
has
(
"
100
"
)).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountQuery_1100 end====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_1100 end====
"
);
done
();
done
();
})
})
...
@@ -245,9 +268,10 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -245,9 +268,10 @@ describe('ActsOsAccountSystemTest', function () {
var
osAccountCreated
=
await
osAccountManager
.
queryAllCreatedOsAccounts
();
var
osAccountCreated
=
await
osAccountManager
.
queryAllCreatedOsAccounts
();
console
.
debug
(
"
====>queryAllCreatedOsAccounts:
"
+
JSON
.
stringify
(
osAccountCreated
));
console
.
debug
(
"
====>queryAllCreatedOsAccounts:
"
+
JSON
.
stringify
(
osAccountCreated
));
for
(
let
i
=
0
,
len
=
osAccountCreated
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
osAccountCreated
.
length
;
i
<
len
;
i
++
)
{
dataMap
.
set
(
osAccountCreated
[
i
].
localId
,
osAccountCreated
[
i
].
localName
)
console
.
debug
(
"
====>contain localId:
"
+
osAccountCreated
[
i
].
localId
);
dataMap
.
set
(
osAccountCreated
[
i
].
localId
.
toString
(),
osAccountCreated
[
i
].
localName
)
}
}
expect
(
dataMap
.
has
(
100
)).
assertTrue
();
expect
(
dataMap
.
has
(
"
100
"
)).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountQuery_1200 end====
"
);
console
.
debug
(
"
====>ActsOsAccountQuery_1200 end====
"
);
done
();
done
();
});
});
...
@@ -262,11 +286,13 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -262,11 +286,13 @@ describe('ActsOsAccountSystemTest', function () {
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
var
createIocalId
;
var
createIocalId
;
var
createIdStr
;
let
dataMap
=
new
Map
();
let
dataMap
=
new
Map
();
osAccountManager
.
createOsAccount
(
"
osAccountNameQueryA
"
,
1
,
(
err
,
osAccountInfo
)
=>
{
osAccountManager
.
createOsAccount
(
"
osAccountNameQueryA
"
,
1
,
(
err
,
osAccountInfo
)
=>
{
console
.
debug
(
"
====>createOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>createOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>createOsAccount osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
console
.
debug
(
"
====>createOsAccount osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
createIocalId
=
osAccountInfo
.
localId
;
createIocalId
=
osAccountInfo
.
localId
;
createIdStr
=
createIocalId
.
toString
();
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
osAccountInfo
.
localName
).
assertEqual
(
"
osAccountNameQueryA
"
);
expect
(
osAccountInfo
.
localName
).
assertEqual
(
"
osAccountNameQueryA
"
);
osAccountManager
.
queryAllCreatedOsAccounts
((
err
,
data
)
=>
{
osAccountManager
.
queryAllCreatedOsAccounts
((
err
,
data
)
=>
{
...
@@ -274,12 +300,13 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -274,12 +300,13 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>queryAllCreatedOsAccounts data:
"
+
JSON
.
stringify
(
data
));
console
.
debug
(
"
====>queryAllCreatedOsAccounts data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
err
.
code
).
assertEqual
(
0
);
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
dataMap
.
set
(
data
[
i
].
localId
,
data
[
i
].
localName
)
console
.
debug
(
"
====>contain localId:
"
+
data
[
i
].
localId
);
dataMap
.
set
(
data
[
i
].
localId
.
toString
(),
data
[
i
].
localName
)
}
}
expect
(
dataMap
.
has
(
100
)).
assertTrue
();
expect
(
dataMap
.
has
(
"
100
"
)).
assertTrue
();
expect
(
dataMap
.
has
(
createI
ocalId
)).
assertTrue
();
expect
(
dataMap
.
has
(
createI
dStr
)).
assertTrue
();
if
(
dataMap
.
has
(
createI
ocalId
))
{
if
(
dataMap
.
has
(
createI
dStr
))
{
let
createdlocalName
=
dataMap
.
get
(
createI
ocalId
);
let
createdlocalName
=
dataMap
.
get
(
createI
dStr
);
console
.
debug
(
"
====>query all local users containing localId:
"
+
createIocalId
);
console
.
debug
(
"
====>query all local users containing localId:
"
+
createIocalId
);
console
.
debug
(
"
====>created localName
"
+
createdlocalName
);
console
.
debug
(
"
====>created localName
"
+
createdlocalName
);
expect
(
createdlocalName
).
assertEqual
(
"
osAccountNameQueryA
"
);
expect
(
createdlocalName
).
assertEqual
(
"
osAccountNameQueryA
"
);
...
@@ -304,20 +331,23 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -304,20 +331,23 @@ describe('ActsOsAccountSystemTest', function () {
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
console
.
debug
(
"
====>get AccountManager finish====
"
);
var
createIocalId
;
var
createIocalId
;
var
createIdStr
;
let
dataMap
=
new
Map
();
let
dataMap
=
new
Map
();
var
osAccountInfo
=
await
osAccountManager
.
createOsAccount
(
"
osAccountNameQueryB
"
,
1
);
var
osAccountInfo
=
await
osAccountManager
.
createOsAccount
(
"
osAccountNameQueryB
"
,
1
);
console
.
debug
(
"
====>createOsAccount osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
console
.
debug
(
"
====>createOsAccount osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
createIocalId
=
osAccountInfo
.
localId
;
createIocalId
=
osAccountInfo
.
localId
;
createIdStr
=
createIocalId
.
toString
();
expect
(
osAccountInfo
.
localName
).
assertEqual
(
"
osAccountNameQueryB
"
);
expect
(
osAccountInfo
.
localName
).
assertEqual
(
"
osAccountNameQueryB
"
);
var
data
=
await
osAccountManager
.
queryAllCreatedOsAccounts
();
var
data
=
await
osAccountManager
.
queryAllCreatedOsAccounts
();
console
.
debug
(
"
====>queryAllCreatedOsAccounts data:
"
+
JSON
.
stringify
(
data
));
console
.
debug
(
"
====>queryAllCreatedOsAccounts data:
"
+
JSON
.
stringify
(
data
));
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
dataMap
.
set
(
data
[
i
].
localId
,
data
[
i
].
localName
)
console
.
debug
(
"
====>contain localId:
"
+
data
[
i
].
localId
);
dataMap
.
set
(
data
[
i
].
localId
.
toString
(),
data
[
i
].
localName
)
}
}
expect
(
dataMap
.
has
(
100
)).
assertTrue
();
expect
(
dataMap
.
has
(
"
100
"
)).
assertTrue
();
expect
(
dataMap
.
has
(
createI
ocalId
)).
assertTrue
();
expect
(
dataMap
.
has
(
createI
dStr
)).
assertTrue
();
if
(
dataMap
.
has
(
createI
ocalId
))
{
if
(
dataMap
.
has
(
createI
dStr
))
{
let
createdlocalName
=
dataMap
.
get
(
createI
ocalId
);
let
createdlocalName
=
dataMap
.
get
(
createI
dStr
);
console
.
debug
(
"
====>query all local users containing localId:
"
+
createIocalId
);
console
.
debug
(
"
====>query all local users containing localId:
"
+
createIocalId
);
expect
(
createdlocalName
).
assertEqual
(
"
osAccountNameQueryB
"
);
expect
(
createdlocalName
).
assertEqual
(
"
osAccountNameQueryB
"
);
}
}
...
@@ -362,12 +392,118 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -362,12 +392,118 @@ describe('ActsOsAccountSystemTest', function () {
});
});
/*
/*
* @tc.number : ActsOsAccountIsVerified_0100
* @tc.number : ActsOsAccountQuery_1700
* @tc.name : isOsAccountVerified callback
* @tc.name : queryCurrentOsAccount callback
* @tc.desc : create a os account and check whether the initial state of the os account is verified
* @tc.desc : Get the os account information to which the application belongs
*/
it
(
'
ActsOsAccountQuery_1700
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountQuery_1700 start====
"
);
var
AccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
queryCurrentOsAccount
((
err
,
data
)
=>
{
console
.
debug
(
"
====>queryCurrentOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>queryCurrentOsAccount data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
localId
).
assertEqual
(
0
);
expect
(
data
.
type
.
ADMIN
).
assertEqual
(
0
);
var
serialNumberStr
=
data
.
serialNumber
.
toString
();
var
serialIntercept
=
serialNumberStr
.
substring
(
8
);
console
.
debug
(
"
====>truncate the last eight characters:
"
+
serialIntercept
);
expect
(
serialIntercept
).
assertEqual
(
"
00000000
"
);
expect
(
data
.
isCreateCompleted
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountQuery_1700 end====
"
);
done
();
})
})
/*
* @tc.number : ActsOsAccountQuery_1800
* @tc.name : queryCurrentOsAccount promise
* @tc.desc : Get the os account information to which the application belongs
*/
it
(
'
ActsOsAccountQuery_1800
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountQuery_1800 start====
"
);
var
AccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
data
=
await
AccountManager
.
queryCurrentOsAccount
();
console
.
debug
(
"
====>queryCurrentOsAccount data:
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
localId
).
assertEqual
(
0
);
expect
(
data
.
type
.
ADMIN
).
assertEqual
(
0
);
var
serialNumberStr
=
data
.
serialNumber
.
toString
();
var
serialIntercept
=
serialNumberStr
.
substring
(
8
);
console
.
debug
(
"
====>truncate the last eight characters:
"
+
serialIntercept
);
expect
(
serialIntercept
).
assertEqual
(
"
00000000
"
);
expect
(
data
.
isCreateCompleted
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountQuery_1800 end====
"
);
done
();
})
/*
* @tc.number : ActsOsAccountQuery_1900
* @tc.name : queryCurrentOsAccount callback
* @tc.desc : Get the local user to which the application belongs when creating and switching a local user
*/
it
(
'
ActsOsAccountQuery_1900
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountQuery_1900 start====
"
);
var
AccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
createLocalId
;
AccountManager
.
createOsAccount
(
"
OsAccountNameA
"
,
1
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>createOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>createOsAccount data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
).
assertEqual
(
0
);
createLocalId
=
data
.
localId
;
expect
(
data
.
localName
).
assertEqual
(
"
OsAccountNameA
"
);
AccountManager
.
activateOsAccount
(
createLocalId
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
AccountManager
.
queryCurrentOsAccount
((
err
,
currentOsInfo
)
=>
{
console
.
debug
(
"
====>queryCurrentOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>queryCurrentOsAccount data:
"
+
JSON
.
stringify
(
currentOsInfo
));
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
currentOsInfo
.
localId
).
assertEqual
(
0
);
AccountManager
.
removeOsAccount
(
createLocalId
,
(
err
)
=>
{
console
.
debug
(
"
====>remove localId:
"
+
createLocalId
+
"
err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
console
.
debug
(
"
====>ActsOsAccountQuery_1900 end====
"
);
done
();
})
})
})
})
})
/*
* @tc.number : ActsOsAccountQuery_2000
* @tc.name : queryCurrentOsAccount promise
* @tc.desc : Get the local user to which the application belongs when creating and switching a local user
*/
it
(
'
ActsOsAccountQuery_2000
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountQuery_2000 start====
"
);
var
AccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
createLocalId
;
var
data
=
await
AccountManager
.
createOsAccount
(
"
OsAccountNameB
"
,
1
);
console
.
debug
(
"
====>createOsAccount data:
"
+
JSON
.
stringify
(
data
));
createLocalId
=
data
.
localId
;
expect
(
data
.
localName
).
assertEqual
(
"
OsAccountNameB
"
);
await
AccountManager
.
activateOsAccount
(
createLocalId
);
var
currentOsInfo
=
await
AccountManager
.
queryCurrentOsAccount
();
console
.
debug
(
"
====>queryCurrentOsAccount:
"
+
JSON
.
stringify
(
currentOsInfo
));
expect
(
currentOsInfo
.
localId
).
assertEqual
(
0
);
await
AccountManager
.
removeOsAccount
(
createLocalId
);
console
.
debug
(
"
====>ActsOsAccountQuery_2000 end====
"
);
done
();
})
/*
* @tc.number : ActsOsAccountIsVerified_1100
* @tc.name : isOsAccountVerified callback
* @tc.desc : create a os account and check whether the initial state of the os account is verified
*/
*/
it
(
'
ActsOsAccountIsVerified_
0
100
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsVerified_
1
100
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_
0
100 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_
1
100 start====
"
);
var
AccountManager
=
osaccount
.
getAccountManager
();
var
AccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
osLocalId
;
var
osLocalId
;
...
@@ -385,7 +521,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -385,7 +521,7 @@ describe('ActsOsAccountSystemTest', function () {
AccountManager
.
removeOsAccount
(
osLocalId
,
(
err
)
=>
{
AccountManager
.
removeOsAccount
(
osLocalId
,
(
err
)
=>
{
console
.
debug
(
"
====>removeOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>removeOsAccount err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
err
.
code
).
assertEqual
(
0
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_
0
100 end====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_
1
100 end====
"
);
done
();
done
();
})
})
})
})
...
@@ -393,12 +529,12 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -393,12 +529,12 @@ describe('ActsOsAccountSystemTest', function () {
})
})
/*
/*
* @tc.number
: ActsOsAccountIsVerified_0
200
* @tc.number
: ActsOsAccountIsVerified_1
200
* @tc.name
: isOsAccountVerified promise
* @tc.name : isOsAccountVerified promise
* @tc.desc
: create a os account and check whether the initial state of the os account is verified
* @tc.desc : create a os account and check whether the initial state of the os account is verified
*/
*/
it
(
'
ActsOsAccountIsVerified_
0
200
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsVerified_
1
200
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_
0
200 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_
1
200 start====
"
);
var
AccountManager
=
osaccount
.
getAccountManager
();
var
AccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
data
=
await
AccountManager
.
createOsAccount
(
"
OsAccountNameVerfiedB
"
,
1
);
var
data
=
await
AccountManager
.
createOsAccount
(
"
OsAccountNameVerfiedB
"
,
1
);
...
@@ -416,7 +552,7 @@ describe('ActsOsAccountSystemTest', function () {
...
@@ -416,7 +552,7 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>isOsAccountVerified data:
"
+
data
);
console
.
debug
(
"
====>isOsAccountVerified data:
"
+
data
);
expect
(
data
).
assertEqual
(
false
);
expect
(
data
).
assertEqual
(
false
);
await
AccountManager
.
removeOsAccount
(
osAccountLocalId
);
await
AccountManager
.
removeOsAccount
(
osAccountLocalId
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_
0
200 end====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_
1
200 end====
"
);
done
();
done
();
})
})
})
})
\ No newline at end of file
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/test/OsAccountIs.test.js
浏览文件 @
9c02dfe3
...
@@ -15,13 +15,15 @@
...
@@ -15,13 +15,15 @@
import
osAccount
from
'
@ohos.account.osAccount
'
import
osAccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUT
=
1000
;
const
ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR
=
4587543
;
const
ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR
=
4587546
;
describe
(
'
ActsOsAccountThirdPartyTest
'
,
function
()
{
describe
(
'
ActsOsAccountThirdPartyTest
'
,
function
()
{
/*
/*
* @tc.number
: ActsOsAccountDeviceId_0100
* @tc.number : ActsOsAccountDeviceId_0100
* @tc.name
: getDistributedVirtualDeviceId callback
* @tc.name : getDistributedVirtualDeviceId callback
* @tc.desc
: get distributed virtual device ID
* @tc.desc : get distributed virtual device ID
*/
*/
it
(
'
ActsOsAccountDeviceId_0100
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountDeviceId_0100
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountDeviceId_0100 start====
"
);
console
.
debug
(
"
====>ActsOsAccountDeviceId_0100 start====
"
);
...
@@ -38,9 +40,9 @@ describe('ActsOsAccountThirdPartyTest', function () {
...
@@ -38,9 +40,9 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
})
/*
/*
* @tc.number
: ActsOsAccountDeviceId_0200
* @tc.number : ActsOsAccountDeviceId_0200
* @tc.name
: getDistributedVirtualDeviceId promise
* @tc.name : getDistributedVirtualDeviceId promise
* @tc.desc
: get distributed virtual device ID
* @tc.desc : get distributed virtual device ID
*/
*/
it
(
'
ActsOsAccountDeviceId_0200
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountDeviceId_0200
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountDeviceId_0200 start====
"
);
console
.
debug
(
"
====>ActsOsAccountDeviceId_0200 start====
"
);
...
@@ -61,15 +63,15 @@ describe('ActsOsAccountThirdPartyTest', function () {
...
@@ -61,15 +63,15 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
})
/*
/*
* @tc.number
: ActsOsAccountIsActived_0100
* @tc.number : ActsOsAccountIsActived_0100
* @tc.name
: isOsAccountActived callback
* @tc.name : isOsAccountActived callback
* @tc.desc
: Verify that users are not switched and query 100 users as activ
e
* @tc.desc
: Verify query 0 user status is tru
e
*/
*/
it
(
'
ActsOsAccountIsActived_0100
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsActived_0100
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsActived_0100 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0100 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isOsAccountActived
(
10
0
,
(
err
,
isActived
)
=>
{
AccountManager
.
isOsAccountActived
(
0
,
(
err
,
isActived
)
=>
{
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountActived isActived:
"
+
isActived
);
console
.
debug
(
"
====>isOsAccountActived isActived:
"
+
isActived
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
err
.
code
).
assertEqual
(
0
);
...
@@ -80,16 +82,16 @@ describe('ActsOsAccountThirdPartyTest', function () {
...
@@ -80,16 +82,16 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
})
/*
/*
* @tc.number
: ActsOsAccountIsActived_0200
* @tc.number : ActsOsAccountIsActived_0200
* @tc.name
: isOsAccountActived promise
* @tc.name : isOsAccountActived promise
* @tc.desc
: Verify that users are not switched and query 100 users as activ
e
* @tc.desc
: Verify query 0 user status is tru
e
*/
*/
it
(
'
ActsOsAccountIsActived_0200
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsActived_0200
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsActived_0200 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0200 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
try
{
try
{
var
isActived
=
await
AccountManager
.
isOsAccountActived
(
10
0
);
var
isActived
=
await
AccountManager
.
isOsAccountActived
(
0
);
}
}
catch
(
err
){
catch
(
err
){
console
.
debug
(
"
====>catch isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>catch isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
...
@@ -103,84 +105,128 @@ describe('ActsOsAccountThirdPartyTest', function () {
...
@@ -103,84 +105,128 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
})
/*
/*
* @tc.number
: ActsOsAccountIsActived_0300
* @tc.number : ActsOsAccountIsActived_0300
* @tc.name
: isOsAccountActived callback
* @tc.name : isOsAccountActived callback
* @tc.desc
: Authentication query 0 user active status failed
* @tc.desc
: Authentication failed to query the active status of the user that does not exist
*/
*/
it
(
'
ActsOsAccountIsActived_0300
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsActived_0300
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsActived_0300 start
"
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0300 start
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isOsAccountActived
(
0
,
(
err
)
=>
{
var
nonExistLocalId
=
1000
;
AccountManager
.
isOsAccountActived
(
nonExistLocalId
,
(
err
)
=>
{
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0300 end
"
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0300 end
"
);
done
();
done
();
})
})
})
})
/*
/*
* @tc.number
: ActsOsAccountIsActived_0400
* @tc.number : ActsOsAccountIsActived_0400
* @tc.name
: isOsAccountActived promise
* @tc.name : isOsAccountActived promise
* @tc.desc
: Authentication query 0 user active status failed
* @tc.desc
: Authentication failed to query the active status of the user that does not exist
*/
*/
it
(
'
ActsOsAccountIsActived_0400
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsActived_0400
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>
isOsAccount
Actived_0400 start====
"
);
console
.
debug
(
"
====>
ActsOsAccountIs
Actived_0400 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
nonExistLocalId
=
1000
;
try
{
try
{
await
AccountManager
.
isOsAccountActived
(
0
);
await
AccountManager
.
isOsAccountActived
(
nonExistLocalId
);
}
}
catch
(
err
){
catch
(
err
){
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0400 end
"
);
done
();
done
();
}
}
})
})
/*
/*
* @tc.number
: ActsOsAccountIsActived_0500
* @tc.number : ActsOsAccountIsActived_0500
* @tc.name
: isOsAccountActived callback
* @tc.name : isOsAccountActived callback
* @tc.desc
: Authentication failed to query the active status of the user that does not exist
* @tc.desc
: Verify that the query active state is not received with parameter type mismatch
*/
*/
it
(
'
ActsOsAccountIsActived_0500
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsActived_0500
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsActived_0500 start
"
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0500 start
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
nonExistLocalId
=
1000
;
var
localIdStr
=
"
100
"
;
AccountManager
.
isOsAccountActived
(
nonExistLocalId
,
(
err
)
=>
{
function
funcIsActived
(
err
,
data
){
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>error received callback====
"
);
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>receive isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>ActsOsAccountIsActived_0500 end
"
);
console
.
debug
(
"
====>receive isOsAccountActived data:
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
done
();
})
}
AccountManager
.
isOsAccountActived
(
localIdStr
,
funcIsActived
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountIsActived_0500 end====
"
);
done
();
},
TIMEOUT
);
})
})
/*
/*
* @tc.number
: ActsOsAccountIsActived_0600
* @tc.number : ActsOsAccountIsActived_0600
* @tc.name
: isOsAccountActived promise
* @tc.name : isOsAccountActived promise
* @tc.desc
: Authentication failed to query the active status of the user that does not exist
* @tc.desc
: Verify that the query active state is not received with parameter type mismatch
*/
*/
it
(
'
ActsOsAccountIsActived_0600
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsActived_0600
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsActived_0600 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0600 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
nonExistLocalId
=
1000
;
var
localIdStr
=
"
100
"
;
try
{
var
isActived
=
await
AccountManager
.
isOsAccountActived
(
localIdStr
);
await
AccountManager
.
isOsAccountActived
(
nonExistLocalId
);
console
.
debug
(
"
====>get active status is:
"
+
isActived
);
}
expect
(
isActived
).
assertEqual
(
null
);
catch
(
err
){
console
.
debug
(
"
====>ActsOsAccountIsActived_0600 end====
"
);
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
done
();
expect
(
err
.
code
!=
0
).
assertTrue
();
})
console
.
debug
(
"
====>ActsOsAccountIsActived_0600 end
"
);
/*
* @tc.number : ActsOsAccountIsActived_0700
* @tc.name : isOsAccountActived callback
* @tc.desc : Verify that the query active state is not received with parameter undefined
*/
it
(
'
ActsOsAccountIsActived_0700
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsActived_0700 start
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
function
funcIsActived
(
err
,
data
){
console
.
debug
(
"
====>error received callback====
"
);
console
.
debug
(
"
====>receive isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>receive isOsAccountActived data:
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
done
();
}
}
AccountManager
.
isOsAccountActived
(
undefined
,
funcIsActived
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountIsActived_0700 end====
"
);
done
();
},
TIMEOUT
);
})
})
/*
/*
* @tc.number : ActsOsAccountIsMulty_0100
* @tc.number : ActsOsAccountIsActived_0800
* @tc.name : isMultiOsAccountEnable callback
* @tc.name : isOsAccountActived promise
* @tc.desc : Check whether the function of supporting multiple os account is enabled
* @tc.desc : Verify that the query active state is not received with parameter undefined
*/
it
(
'
ActsOsAccountIsActived_0800
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsActived_0800 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
isActived
=
await
AccountManager
.
isOsAccountActived
(
undefined
);
console
.
debug
(
"
====>get active status is:
"
+
isActived
);
expect
(
isActived
).
assertEqual
(
null
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0800 end====
"
);
done
();
})
/*
* @tc.number : ActsOsAccountIsMulty_0100
* @tc.name : isMultiOsAccountEnable callback
* @tc.desc : Check whether the function of supporting multiple os account is enabled
*/
*/
it
(
'
ActsOsAccountIsMulty_0100
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsMulty_0100
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsMulty_0100 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsMulty_0100 start====
"
);
...
@@ -197,9 +243,9 @@ describe('ActsOsAccountThirdPartyTest', function () {
...
@@ -197,9 +243,9 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
})
/*
/*
* @tc.number
: ActsOsAccountIsMulty_0200
* @tc.number : ActsOsAccountIsMulty_0200
* @tc.name
: isMultiOsAccountEnable promise
* @tc.name : isMultiOsAccountEnable promise
* @tc.desc
: Check whether the function of supporting multiple os account is enabled
* @tc.desc : Check whether the function of supporting multiple os account is enabled
*/
*/
it
(
'
ActsOsAccountIsMulty_0200
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsMulty_0200
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsMulty_0200 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsMulty_0200 start====
"
);
...
@@ -220,120 +266,159 @@ describe('ActsOsAccountThirdPartyTest', function () {
...
@@ -220,120 +266,159 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
})
/*
/*
* @tc.number : ActsOsAccountIsVerified_0300
* @tc.number : ActsOsAccountVerified_0100
* @tc.name : isOsAccountVerified callback
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query 0 user is unlocked failed
* @tc.desc : Verify that the initial state query is unlocked to false
*/
it
(
'
ActsOsAccountVerified_0100
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>isOsAccountVerified_0100 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isOsAccountVerified
((
err
,
data
)
=>
{
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountVerified data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertEqual
(
false
);
console
.
debug
(
"
====>ActsOsAccountVerified_0100 end====
"
);
done
();
})
})
/*
* @tc.number : ActsOsAccountVerified_0200
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify that the initial state query is unlocked to false
*/
it
(
'
ActsOsAccountVerified_0200
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>isOsAccountVerified_0200 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
isVerified
=
await
AccountManager
.
isOsAccountVerified
();
console
.
debug
(
"
====>isOsAccountVerified data:
"
+
isVerified
);
expect
(
isVerified
).
assertEqual
(
false
);
console
.
debug
(
"
====>ActsOsAccountVerified_0200 end====
"
);
done
();
})
/*
* @tc.number : ActsOsAccountIsVerified_0300
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify that the initial state query 0 user is unlocked to false
*/
*/
it
(
'
ActsOsAccountIsVerified_0300
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsVerified_0300
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0300 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0300 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isOsAccountVerified
(
0
,
(
err
)
=>
{
AccountManager
.
isOsAccountVerified
(
0
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertFalse
();
console
.
debug
(
"
====>ActsOsAccountIsVerified_0300 end====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0300 end====
"
);
done
();
done
();
})
})
})
})
/*
/*
* @tc.number
: ActsOsAccountIsVerified_0400
* @tc.number : ActsOsAccountIsVerified_0400
* @tc.name
: isOsAccountVerified promise
* @tc.name : isOsAccountVerified promise
* @tc.desc
: Verify query 0 user is unlocked failed
* @tc.desc
: Verify that the initial state query 0 user is unlocked to false
*/
*/
it
(
'
ActsOsAccountIsVerified_0400
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsVerified_0400
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0400 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0400 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
try
{
var
isVerified
=
await
AccountManager
.
isOsAccountVerified
(
0
);
await
AccountManager
.
isOsAccountVerified
(
0
);
expect
(
isVerified
).
assertFalse
();
}
console
.
debug
(
"
====>ActsOsAccountIsVerified_0400 end====
"
);
catch
(
err
){
done
();
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountIsVerified_0400 end====
"
);
done
();
}
})
})
/*
/*
* @tc.number
: ActsOsAccountIsVerified_0500
* @tc.number : ActsOsAccountIsVerified_0500
* @tc.name
: isOsAccountVerified callback
* @tc.name : isOsAccountVerified callback
* @tc.desc
: Verify query "100" user is unlocked failed
* @tc.desc : Verify query "100" user is unlocked failed
*/
*/
it
(
'
ActsOsAccountIsVerified_0500
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsVerified_0500
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0500 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0500 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isOsAccountVerified
(
"
100
"
,
(
err
)
=>
{
var
localIdStr
=
"
100
"
;
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
function
funcIsVerified
(
err
,
data
){
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>error received callback====
"
);
console
.
debug
(
"
====>receive isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>receive isOsAccountVerified data:
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}
AccountManager
.
isOsAccountVerified
(
localIdStr
,
funcIsVerified
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountIsVerified_0500 end====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0500 end====
"
);
done
();
done
();
}
)
}
,
TIMEOUT
);
})
})
/*
/*
* @tc.number
: ActsOsAccountIsVerified_0600
* @tc.number : ActsOsAccountIsVerified_0600
* @tc.name
: isOsAccountVerified promise
* @tc.name : isOsAccountVerified promise
* @tc.desc
: Verify query "100" user is unlocked failed
* @tc.desc : Verify query "100" user is unlocked failed
*/
*/
it
(
'
ActsOsAccountIsVerified_0600
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsVerified_0600
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0600 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0600 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
try
{
var
localIdStr
=
"
100
"
;
await
AccountManager
.
isOsAccountVerified
(
"
100
"
);
var
isVerified
=
await
AccountManager
.
isOsAccountVerified
(
localIdStr
);
}
console
.
debug
(
"
====>get verified status is:
"
+
isVerified
);
catch
(
err
){
expect
(
isVerified
).
assertEqual
(
null
);
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>ActsOsAccountIsVerified_0600 end====
"
);
expect
(
err
.
code
!=
0
).
assertTrue
();
done
();
console
.
debug
(
"
====>ActsOsAccountIsVerified_0600 end====
"
);
done
();
}
})
})
/*
/*
* @tc.number
: ActsOsAccountIsVerified_0700
* @tc.number : ActsOsAccountIsVerified_0700
* @tc.name
: isOsAccountVerified callback
* @tc.name : isOsAccountVerified callback
* @tc.desc
: Verify query undefined user is unlocked failed
* @tc.desc : Verify query undefined user is unlocked failed
*/
*/
it
(
'
ActsOsAccountIsVerified_0700
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsVerified_0700
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0700 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0700 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isOsAccountVerified
(
undefined
,
(
err
)
=>
{
var
localIdUndefined
=
undefined
;
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
function
funcIsVerified
(
err
,
data
){
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>error received callback====
"
);
console
.
debug
(
"
====>receive isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>receive isOsAccountVerified data:
"
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}
AccountManager
.
isOsAccountVerified
(
localIdUndefined
,
funcIsVerified
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountIsVerified_0700 end====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0700 end====
"
);
done
();
done
();
}
)
}
,
TIMEOUT
);
})
})
/*
/*
* @tc.number
: ActsOsAccountIsVerified_0800
* @tc.number : ActsOsAccountIsVerified_0800
* @tc.name
: isOsAccountVerified promise
* @tc.name : isOsAccountVerified promise
* @tc.desc
: Verify query undefined user is unlocked failed
* @tc.desc : Verify query undefined user is unlocked failed
*/
*/
it
(
'
ActsOsAccountIsVerified_0800
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsVerified_0800
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0800 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0800 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
console
.
debug
(
"
====>get os AccountManager finish====
"
);
try
{
var
localIdUndefined
=
undefined
;
await
AccountManager
.
isOsAccountVerified
(
undefined
);
var
isVerified
=
await
AccountManager
.
isOsAccountVerified
(
localIdUndefined
);
}
console
.
debug
(
"
====>get verified status is:
"
+
isVerified
);
catch
(
err
){
expect
(
isVerified
).
assertEqual
(
null
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0800 err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>ActsOsAccountIsVerified_0800 end====
"
);
expect
(
err
.
code
!=
0
).
assertTrue
();
done
();
console
.
debug
(
"
====>ActsOsAccountIsVerified_0800 end====
"
);
done
();
}
})
})
/*
/*
* @tc.number
: ActsOsAccountIsVerified_0900
* @tc.number : ActsOsAccountIsVerified_0900
* @tc.name
: isOsAccountVerified callback
* @tc.name : isOsAccountVerified callback
* @tc.desc
: Verify query does not exist user unlock failed
* @tc.desc : Verify query does not exist user unlock failed
*/
*/
it
(
'
ActsOsAccountIsVerified_0900
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsVerified_0900
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0900 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0900 start====
"
);
...
@@ -342,16 +427,16 @@ describe('ActsOsAccountThirdPartyTest', function () {
...
@@ -342,16 +427,16 @@ describe('ActsOsAccountThirdPartyTest', function () {
var
osAccountLocalId
=
1000
;
var
osAccountLocalId
=
1000
;
AccountManager
.
isOsAccountVerified
(
osAccountLocalId
,
(
err
)
=>
{
AccountManager
.
isOsAccountVerified
(
osAccountLocalId
,
(
err
)
=>
{
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0900 end====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0900 end====
"
);
done
();
done
();
})
})
})
})
/*
/*
* @tc.number
: ActsOsAccountIsVerified_1000
* @tc.number : ActsOsAccountIsVerified_1000
* @tc.name
: isOsAccountVerified promise
* @tc.name : isOsAccountVerified promise
* @tc.desc
: Verify query does not exist user unlock failed
* @tc.desc : Verify query does not exist user unlock failed
*/
*/
it
(
'
ActsOsAccountIsVerified_1000
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsVerified_1000
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_1000 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_1000 start====
"
);
...
@@ -363,16 +448,16 @@ describe('ActsOsAccountThirdPartyTest', function () {
...
@@ -363,16 +448,16 @@ describe('ActsOsAccountThirdPartyTest', function () {
}
}
catch
(
err
){
catch
(
err
){
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
(
);
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_1000 end====
"
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_1000 end====
"
);
done
();
done
();
}
}
})
})
/*
/*
* @tc.number
: ActsOsAccountIsTest_0100
* @tc.number : ActsOsAccountIsTest_0100
* @tc.name
: isTestOsAccount callback
* @tc.name : isTestOsAccount callback
* @tc.desc
: check whether this OS account is a test OS account
* @tc.desc : check whether this OS account is a test OS account
*/
*/
it
(
'
ActsOsAccountIsTest_0100
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsTest_0100
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsTest_0100 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsTest_0100 start====
"
);
...
@@ -389,9 +474,9 @@ describe('ActsOsAccountThirdPartyTest', function () {
...
@@ -389,9 +474,9 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
})
/*
/*
* @tc.number
: ActsOsAccountIsTest_0200
* @tc.number : ActsOsAccountIsTest_0200
* @tc.name
: isTestOsAccount promise
* @tc.name : isTestOsAccount promise
* @tc.desc
: check whether this OS account is a test OS account
* @tc.desc : check whether this OS account is a test OS account
*/
*/
it
(
'
ActsOsAccountIsTest_0200
'
,
0
,
async
function
(
done
){
it
(
'
ActsOsAccountIsTest_0200
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsTest_0200 start====
"
);
console
.
debug
(
"
====>ActsOsAccountIsTest_0200 start====
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录