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 @@
import
osaccount
from
'
@ohos.account.osAccount
'
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
()
{
/*
...
...
@@ -26,17 +28,29 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountActivate_0100 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
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 data:
"
+
data
);
console
.
debug
(
"
====>isOsAccountActived data:
"
+
isActived
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertTrue
();
osAccountManager
.
activateOsAccount
(
100
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_0100 end====
"
);
done
();
})
if
(
isActived
){
osAccountManager
.
activateOsAccount
(
100
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR
);
console
.
debug
(
"
====>ActsOsAccountActivate_0100 end====
"
);
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 () {
console
.
debug
(
"
====>ActsOsAccountActivate_0200 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
var
isActived
=
await
osAccountManager
.
isOsAccountActived
(
100
);
}
catch
(
err
){
console
.
error
(
"
====>catch isOsAccountActived 0200 err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
var
isActived
=
await
osAccountManager
.
isOsAccountActived
(
100
);
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
isActived
));
expect
(
isActived
).
assertTrue
();
try
{
if
(
isActived
){
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
);
}
catch
(
err
){
console
.
debug
(
"
====>catch activateOsAccount 0200 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_0200 end====
"
);
done
();
}
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
();
}
}
});
/*
...
...
@@ -158,7 +178,7 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
0
,
(
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====
"
);
done
();
})
...
...
@@ -177,7 +197,7 @@ describe('ActsOsAccountSystemTest', function () {
await
osAccountManager
.
activateOsAccount
(
0
);
}
catch
(
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====
"
);
done
();
}
...
...
@@ -194,7 +214,7 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
-
1
,
(
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====
"
);
done
();
})
...
...
@@ -213,7 +233,7 @@ describe('ActsOsAccountSystemTest', function () {
await
osAccountManager
.
activateOsAccount
(
-
1
);
}
catch
(
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====
"
);
done
();
}
...
...
@@ -228,12 +248,18 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountActivate_0900 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
"
Abc
"
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount to 'Abc' user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
var
localIdStr
=
"
100
"
;
function
funcActivateCallback
(
err
){
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====
"
);
done
();
}
)
}
,
TIMEOUT
);
});
/*
...
...
@@ -245,14 +271,11 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountActivate_1000 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
await
osAccountManager
.
activateOsAccount
(
"
Abc
"
);
}
catch
(
err
){
console
.
debug
(
"
====>activateOsAccount to 'Abc' user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_1000 end====
"
);
done
();
}
var
localIdStr
=
"
100
"
;
var
activateResult
=
await
osAccountManager
.
activateOsAccount
(
localIdStr
);
expect
(
activateResult
).
assertEqual
(
null
);
console
.
debug
(
"
====>ActsOsAccountActivate_1000 end====
"
);
done
();
});
/*
...
...
@@ -264,12 +287,17 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountActivate_1100 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
undefined
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount to undefined user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
function
funcActivateCallback
(
err
){
console
.
debug
(
"
====>error received callback====
"
);
console
.
debug
(
"
====>receive activateOsAccount err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
osAccountManager
.
activateOsAccount
(
undefined
,
funcActivateCallback
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountActivate_1100 end====
"
);
done
();
}
)
}
,
TIMEOUT
);
});
/*
...
...
@@ -281,14 +309,10 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>ActsOsAccountActivate_1200 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
await
osAccountManager
.
activateOsAccount
(
undefined
);
}
catch
(
err
){
console
.
debug
(
"
====>activateOsAccount to undefined user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_1200 end====
"
);
done
();
}
var
activateResult
=
await
osAccountManager
.
activateOsAccount
(
undefined
);
expect
(
activateResult
).
assertEqual
(
null
);
console
.
debug
(
"
====>ActsOsAccountActivate_1200 end====
"
);
done
();
});
/*
...
...
@@ -303,7 +327,7 @@ describe('ActsOsAccountSystemTest', function () {
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
nonExistentLocalId
,
(
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====
"
);
done
();
})
...
...
@@ -323,7 +347,7 @@ describe('ActsOsAccountSystemTest', function () {
await
osAccountManager
.
activateOsAccount
(
nonExistentLocalId
);
}
catch
(
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====
"
);
done
();
}
...
...
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/OnOff.test.js
浏览文件 @
9c02dfe3
...
...
@@ -245,7 +245,7 @@ describe('ActsOsAccountSystemTest', function () {
/*
* @tc.number : ActsOsAccountOnOff_0700
* @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
)
{
console
.
debug
(
"
====>ActsOsAccountOnOff_0700 start====
"
);
...
...
@@ -269,7 +269,7 @@ describe('ActsOsAccountSystemTest', function () {
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
osAccountInfo
.
localName
).
assertEqual
(
"
osAccountNameE
"
);
osAccountManager
.
activateOsAccount
(
localId
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>activateOsAccount err
code
:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
setTimeout
(()
=>
{
osAccountManager
.
removeOsAccount
(
localId
,
(
err
)
=>
{
...
...
@@ -286,7 +286,7 @@ describe('ActsOsAccountSystemTest', function () {
/*
* @tc.number : ActsOsAccountOnOff_0800
* @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
)
{
console
.
debug
(
"
====>ActsOsAccountOnOff_0800 start====
"
);
...
...
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/Query.test.js
浏览文件 @
9c02dfe3
此差异已折叠。
点击以展开。
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/test/OsAccountIs.test.js
浏览文件 @
9c02dfe3
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录