Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
76f3099f
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看板
提交
76f3099f
编写于
11月 24, 2021
作者:
Z
zhaoyuan17
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update account xts code 1124
Signed-off-by:
N
zhaoyuan17
<
zhaoyuan17@huawei.com
>
上级
4937a85b
变更
11
展开全部
显示空白变更内容
内联
并排
Showing
11 changed file
with
1146 addition
and
128 deletion
+1146
-128
account/appaccount/actsaccountchangeonoff/entry/src/main/js/test/ExampleJsunit.test.js
...tchangeonoff/entry/src/main/js/test/ExampleJsunit.test.js
+427
-11
account/appaccount/actsaccounttest/entry/src/main/js/test/AddAccount.test.js
...actsaccounttest/entry/src/main/js/test/AddAccount.test.js
+123
-21
account/appaccount/actsaccounttest/entry/src/main/js/test/AppAccess.test.js
.../actsaccounttest/entry/src/main/js/test/AppAccess.test.js
+1
-1
account/appaccount/actsaccounttest/entry/src/main/js/test/AssociatedData.test.js
...accounttest/entry/src/main/js/test/AssociatedData.test.js
+1
-1
account/appaccount/actsaccounttest/entry/src/main/js/test/CreatManager.test.js
...tsaccounttest/entry/src/main/js/test/CreatManager.test.js
+1
-1
account/appaccount/actsaccounttest/entry/src/main/js/test/Credential.test.js
...actsaccounttest/entry/src/main/js/test/Credential.test.js
+1
-1
account/appaccount/actsaccounttest/entry/src/main/js/test/DeleteAccount.test.js
...saccounttest/entry/src/main/js/test/DeleteAccount.test.js
+82
-82
account/appaccount/actsaccounttest/entry/src/main/js/test/ExtraInfo.test.js
.../actsaccounttest/entry/src/main/js/test/ExtraInfo.test.js
+1
-1
account/appaccount/actsaccounttest/entry/src/main/js/test/NoPermission.test.js
...tsaccounttest/entry/src/main/js/test/NoPermission.test.js
+1
-1
account/appaccount/actsaccounttest/entry/src/main/js/test/OAuthToken.test.js
...actsaccounttest/entry/src/main/js/test/OAuthToken.test.js
+346
-1
account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/js/default/pages/index/index.js
...sceneonoff/entry/src/main/js/default/pages/index/index.js
+162
-7
未找到文件。
account/appaccount/actsaccountchangeonoff/entry/src/main/js/test/ExampleJsunit.test.js
浏览文件 @
76f3099f
此差异已折叠。
点击以展开。
account/appaccount/actsaccounttest/entry/src/main/js/test/AddAccount.test.js
浏览文件 @
76f3099f
...
...
@@ -15,7 +15,8 @@
import
account
from
'
@ohos.account.appAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
STRCOUNT
=
1025
;
const
NAMELIMIT
=
512
;
const
LENGTHLIMIT
=
1024
;
describe
(
'
ActsAccountAddAccount
'
,
function
()
{
/*
...
...
@@ -159,16 +160,16 @@ describe('ActsAccountAddAccount', function () {
/*
* @tc.number : ActsAccountAddAccount_0700
* @tc.name : Add account calllback form
* @tc.desc : The account name exceeds the length limit of
1024
* @tc.desc : The account name exceeds the length limit of
512 characters
*/
it
(
'
ActsAccountAddAccount_0700
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountAddAccount_0700 start====
"
);
var
big
AccountName
=
''
;
for
(
var
i
=
0
;
i
<
STRCOUNT
;
i
++
)
{
big
AccountName
+=
'
t
'
;
var
limit
AccountName
=
''
;
for
(
var
i
=
0
;
i
<
NAMELIMIT
+
1
;
i
++
)
{
limit
AccountName
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
appAccountManager
.
addAccount
(
big
AccountName
,
"
account_extraInfo_callback_fourth
"
,
(
err
)
=>
{
appAccountManager
.
addAccount
(
limit
AccountName
,
"
account_extraInfo_callback_fourth
"
,
(
err
)
=>
{
console
.
debug
(
"
====>add account ActsAccountAddAccount_0700 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountAddAccount_0700 end====
"
);
...
...
@@ -179,17 +180,17 @@ describe('ActsAccountAddAccount', function () {
/*
* @tc.number : ActsAccountAddAccount_0800
* @tc.name : Add account promise form
* @tc.desc : The account name exceeds the length limit of
1024
* @tc.desc : The account name exceeds the length limit of
512 characters
*/
it
(
'
ActsAccountAddAccount_0800
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountAddAccount_0800 start====
"
);
var
bigStr
=
''
;
for
(
var
i
=
0
;
i
<
STRCOUNT
;
i
++
)
{
bigStr
+=
'
t
'
;
var
limitAccountName
=
''
;
for
(
var
i
=
0
;
i
<
NAMELIMIT
+
1
;
i
++
)
{
limitAccountName
+=
'
n
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
try
{
await
appAccountManager
.
addAccount
(
bigStr
,
"
account_extraInfo_promise_fourth
"
);
await
appAccountManager
.
addAccount
(
limitAccountName
,
"
account_extraInfo_promise_fourth
"
);
}
catch
(
err
){
console
.
debug
(
"
====>add account ActsAccountAddAccount_0800 err:
"
+
JSON
.
stringify
(
err
));
...
...
@@ -202,16 +203,16 @@ describe('ActsAccountAddAccount', function () {
/*
* @tc.number : ActsAccountAddAccount_0900
* @tc.name : Add account calllback form
* @tc.desc : Additional information exceeds the length limit of 1024
* @tc.desc : Additional information exceeds the length limit of 1024
characters
*/
it
(
'
ActsAccountAddAccount_0900
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountAddAccount_0900 start====
"
);
var
bigExtraInfo
=
''
;
for
(
var
i
=
0
;
i
<
STRCOUNT
;
i
++
)
{
bigExtraInfo
+=
'
t
'
;
var
limitAccountExtra
=
''
;
for
(
var
i
=
0
;
i
<
LENGTHLIMIT
+
1
;
i
++
)
{
limitAccountExtra
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
appAccountManager
.
addAccount
(
"
account_name_callback_fifth
"
,
bigExtraInfo
,
(
err
)
=>
{
appAccountManager
.
addAccount
(
"
account_name_callback_fifth
"
,
limitAccountExtra
,
(
err
)
=>
{
console
.
debug
(
"
====>add account ActsAccountAddAccount_0900 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountAddAccount_0900 end====
"
);
...
...
@@ -222,17 +223,17 @@ describe('ActsAccountAddAccount', function () {
/*
* @tc.number : ActsAccountAddAccount_1000
* @tc.name : Add account promise form
* @tc.desc : Additional information exceeds the length limit of 1024
* @tc.desc : Additional information exceeds the length limit of 1024
characters
*/
it
(
'
ActsAccountAddAccount_1000
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountAddAccount_1000 start====
"
);
var
bigStr
Extra
=
''
;
for
(
var
i
=
0
;
i
<
STRCOUNT
;
i
++
)
{
bigStrExtra
+=
'
t
'
;
var
limitAccount
Extra
=
''
;
for
(
var
i
=
0
;
i
<
LENGTHLIMIT
+
1
;
i
++
)
{
limitAccountExtra
+=
'
e
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
try
{
await
appAccountManager
.
addAccount
(
"
account_name_promise_fifth
"
,
bigStr
Extra
);
await
appAccountManager
.
addAccount
(
"
account_name_promise_fifth
"
,
limitAccount
Extra
);
}
catch
(
err
){
console
.
debug
(
"
====>add account ActsAccountAddAccount_1000 err:
"
+
JSON
.
stringify
(
err
));
...
...
@@ -539,4 +540,105 @@ describe('ActsAccountAddAccount', function () {
done
();
}
});
/*
* @tc.number : ActsAccountAddAccount_2500
* @tc.name : Add account calllback form
* @tc.desc : The account name reaches the limit of 512 characters
*/
it
(
'
ActsAccountAddAccount_2500
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountAddAccount_2500 start====
"
);
var
limitName
=
''
;
for
(
var
i
=
0
;
i
<
NAMELIMIT
;
i
++
)
{
limitName
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
appAccountManager
.
addAccount
(
limitName
,
"
account_extraInfo_callback
"
,
(
err
)
=>
{
console
.
debug
(
"
====>add account ActsAccountAddAccount_2500 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
deleteAccount
(
limitName
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account ActsAccountAddAccount_2500 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
console
.
debug
(
"
====>ActsAccountAddAccount_2500 end====
"
);
done
();
});
});
});
/*
* @tc.number : ActsAccountAddAccount_2600
* @tc.name : Add account promise form
* @tc.desc : The account name reaches the limit of 512 characters
*/
it
(
'
ActsAccountAddAccount_2600
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountAddAccount_2600 start====
"
);
var
nameLimit
=
''
;
for
(
var
i
=
0
;
i
<
NAMELIMIT
;
i
++
)
{
nameLimit
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>add account ActsAccountAddAccount_2600 start====
"
);
try
{
await
appAccountManager
.
addAccount
(
nameLimit
,
"
account_extraInfo_promise
"
);
}
catch
(
err
){
console
.
error
(
"
====>add account ActsAccountAddAccount_2600 err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
console
.
debug
(
"
====>delete account ActsAccountAddAccount_2600 start====
"
);
await
appAccountManager
.
deleteAccount
(
nameLimit
);
console
.
debug
(
"
====>ActsAccountAddAccount_2600 end====
"
);
done
();
});
/*
* @tc.number : ActsAccountAddAccount_2700
* @tc.name : Add account calllback form
* @tc.desc : Additional information reaches the limit of 1024 characters
*/
it
(
'
ActsAccountAddAccount_2700
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountAddAccount_2700 start====
"
);
var
limitExtra
=
''
;
for
(
var
i
=
0
;
i
<
LENGTHLIMIT
;
i
++
)
{
limitExtra
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
appAccountManager
.
addAccount
(
"
account_extra_callback_limit
"
,
limitExtra
,
(
err
)
=>
{
console
.
debug
(
"
====>add account ActsAccountAddAccount_2700 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
deleteAccount
(
"
account_extra_callback_limit
"
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account ActsAccountAddAccount_2700 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
console
.
debug
(
"
====>ActsAccountAddAccount_2700 end====
"
);
done
();
});
});
});
/*
* @tc.number : ActsAccountAddAccount_2800
* @tc.name : Add account promise form
* @tc.desc : Additional information reaches the limit of 1024 characters
*/
it
(
'
ActsAccountAddAccount_2800
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountAddAccount_2800 start====
"
);
var
extraLimit
=
''
;
for
(
var
i
=
0
;
i
<
LENGTHLIMIT
;
i
++
)
{
extraLimit
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
try
{
await
appAccountManager
.
addAccount
(
"
account_extra_promise_limit
"
,
extraLimit
);
}
catch
(
err
){
console
.
error
(
"
====>add account ActsAccountAddAccount_2800 err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
console
.
debug
(
"
====>delete account ActsAccountAddAccount_2800 start====
"
);
appAccountManager
.
deleteAccount
(
"
account_extra_promise_limit
"
);
console
.
debug
(
"
====>ActsAccountAddAccount_2800 end====
"
);
done
();
});
})
\ No newline at end of file
account/appaccount/actsaccounttest/entry/src/main/js/test/AppAccess.test.js
浏览文件 @
76f3099f
...
...
@@ -15,7 +15,7 @@
import
account
from
'
@ohos.account.appAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUT
=
1000
0
;
const
TIMEOUT
=
1000
;
const
STRCOUNT
=
1025
;
describe
(
'
ActsAccountAppAccess
'
,
function
()
{
function
sleep
(
delay
)
{
...
...
account/appaccount/actsaccounttest/entry/src/main/js/test/AssociatedData.test.js
浏览文件 @
76f3099f
...
...
@@ -15,7 +15,7 @@
import
account
from
'
@ohos.account.appAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUT
=
1000
0
;
const
TIMEOUT
=
1000
;
describe
(
'
ActsAccountAssociatedData
'
,
function
()
{
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
...
...
account/appaccount/actsaccounttest/entry/src/main/js/test/CreatManager.test.js
浏览文件 @
76f3099f
...
...
@@ -15,7 +15,7 @@
import
account
from
'
@ohos.account.appAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUT
=
1000
0
;
const
TIMEOUT
=
1000
;
describe
(
'
ActsCreatAppAccountManager
'
,
function
()
{
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
...
...
account/appaccount/actsaccounttest/entry/src/main/js/test/Credential.test.js
浏览文件 @
76f3099f
...
...
@@ -15,7 +15,7 @@
import
account
from
'
@ohos.account.appAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUT
=
1000
0
;
const
TIMEOUT
=
1000
;
describe
(
'
ActsAccountCredential
'
,
function
()
{
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
...
...
account/appaccount/actsaccounttest/entry/src/main/js/test/DeleteAccount.test.js
浏览文件 @
76f3099f
...
...
@@ -15,7 +15,7 @@
import
account
from
'
@ohos.account.appAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUT
=
1000
0
;
const
TIMEOUT
=
1000
;
const
STRCOUNT
=
1025
;
describe
(
'
ActsAccountDeleteAccount
'
,
function
()
{
function
sleep
(
delay
)
{
...
...
@@ -55,169 +55,169 @@ describe('ActsAccountDeleteAccount', function () {
/*
* @tc.number : ActsAccountDeleteAccount_0200
* @tc.name : Delete account
calllback
form
* @tc.desc : Delete
unadded account in callback
form
* @tc.name : Delete account
promise
form
* @tc.desc : Delete
the added account in promise
form
*/
it
(
'
ActsAccountDeleteAccount_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
ActsAccountDeleteAccount_0200
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountDeleteAccount_0200 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>
creat finish
====
"
);
a
ppAccountManager
.
deleteAccount
(
"
deleteAccount_name_callback_second
"
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account ActsAccountDeleteAccount_0200 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>
add account ActsAccountAddAccount_0200 start
====
"
);
a
wait
appAccountManager
.
addAccount
(
"
deleteAccount_name_promise_first
"
,
"
extraInfo_promise_first
"
);
try
{
await
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_promise_first
"
);
console
.
debug
(
"
====>ActsAccountDeleteAccount_0200 end====
"
);
done
();
});
}
catch
(
err
){
console
.
error
(
"
====>delete account ActsAccountDeleteAccount_0200 err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
});
/*
* @tc.number : ActsAccountDeleteAccount_0300
* @tc.name : Delete account calllback form
* @tc.desc : Delete
the added account, the first time it can be deleted, the second time the deletion fails
* @tc.desc : Delete
unadded account in callback form
*/
it
(
'
ActsAccountDeleteAccount_0300
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountDeleteAccount_0300 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
appAccountManager
.
addAccount
(
"
deleteAccount_name_callback_third
"
,
"
extraInfo_callback_third
"
,
(
err
)
=>
{
console
.
debug
(
"
====>add account ActsAccountDeleteAccount_0300 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_callback_third
"
,
(
err
)
=>
{
console
.
debug
(
"
====>delete account first time err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_callback_third
"
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account second time err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>creat finish====
"
);
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_callback_second
"
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account ActsAccountDeleteAccount_0300 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountDeleteAccount_0300 end====
"
);
done
();
});
});
});
});
/*
* @tc.number : ActsAccountDeleteAccount_0400
* @tc.name : Delete account
calllback
form
* @tc.desc : Delete
the account name exceeds the length limit of 1024
* @tc.name : Delete account
promise
form
* @tc.desc : Delete
unadded account in promise form
*/
it
(
'
ActsAccountDeleteAccount_0400
'
,
0
,
async
function
(
done
){
it
(
'
ActsAccountDeleteAccount_0400
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsAccountDeleteAccount_0400 start====
"
);
var
bigStr
=
''
;
for
(
var
i
=
0
;
i
<
STRCOUNT
;
i
++
)
{
bigStr
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
appAccountManager
.
deleteAccount
(
bigStr
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account ActsAccountDeleteAccount_0400 err:
"
+
JSON
.
stringify
(
err
));
try
{
await
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_promise_second
"
);
}
catch
(
err
){
console
.
debug
(
"
====>delete account ActsAccountDeleteAccount_0400 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountDeleteAccount_0400 end====
"
);
done
();
}
);
}
});
/*
* @tc.number : ActsAccountDeleteAccount_0500
* @tc.name : Delete account calllback form
* @tc.desc : Delete the a
ccount name is an empty string
* @tc.desc : Delete the a
dded account, the first time it can be deleted, the second time the deletion fails
*/
it
(
'
ActsAccountDeleteAccount_0500
'
,
0
,
async
function
(
done
)
{
it
(
'
ActsAccountDeleteAccount_0500
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountDeleteAccount_0500 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
appAccountManager
.
deleteAccount
(
""
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account ActsAccountDeleteAccount_0500 err:
"
+
JSON
.
stringify
(
err
));
appAccountManager
.
addAccount
(
"
deleteAccount_name_callback_third
"
,
"
extraInfo_callback_third
"
,
(
err
)
=>
{
console
.
debug
(
"
====>add account ActsAccountDeleteAccount_0500 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_callback_third
"
,
(
err
)
=>
{
console
.
debug
(
"
====>delete account first time err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_callback_third
"
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account second time err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountDeleteAccount_0500 end====
"
);
done
();
});
});
});
});
/*
* @tc.number : ActsAccountDeleteAccount_0600
* @tc.name : Delete account promise form
* @tc.desc : Delete the added account
in promise form
* @tc.desc : Delete the added account
, the first time it can be deleted, the second time the deletion fails
*/
it
(
'
ActsAccountDeleteAccount_0600
'
,
0
,
async
function
(
done
){
it
(
'
ActsAccountDeleteAccount_0600
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsAccountDeleteAccount_0600 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>add account ActsAccountAddAccount_0600 start====
"
);
await
appAccountManager
.
addAccount
(
"
deleteAccount_name_promise_first
"
,
"
extraInfo_promise_first
"
);
await
appAccountManager
.
addAccount
(
"
deleteAccount_name_promise_third
"
,
"
extraInfo_promise_third
"
);
console
.
debug
(
"
====>delete Account first time ActsAccountDeleteAccount_0600 start====
"
);
await
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_promise_third
"
);
console
.
debug
(
"
====>delete Account second time ActsAccountDeleteAccount_0600 start====
"
);
try
{
await
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_promise_first
"
);
console
.
debug
(
"
====>ActsAccountDeleteAccount_0600 end====
"
);
done
();
await
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_promise_third
"
);
}
catch
(
err
){
console
.
error
(
"
====>delete account ActsAccountDeleteAccount_0600 err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
console
.
debug
(
"
====>delete account ActsAccountDeleteAccount_0600 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountDeleteAccount_0600 end====
"
);
done
();
}
});
/*
* @tc.number : ActsAccountDeleteAccount_0700
* @tc.name : Delete account
promise
form
* @tc.desc : Delete
unadded account in promise form
* @tc.name : Delete account
calllback
form
* @tc.desc : Delete
the account name exceeds the length limit of 1024
*/
it
(
'
ActsAccountDeleteAccount_0700
'
,
0
,
async
function
(
done
){
it
(
'
ActsAccountDeleteAccount_0700
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsAccountDeleteAccount_0700 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
()
;
try
{
await
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_promise_second
"
)
;
var
bigStr
=
''
;
for
(
var
i
=
0
;
i
<
STRCOUNT
;
i
++
)
{
bigStr
+=
'
t
'
;
}
catch
(
err
){
console
.
debug
(
"
====>delete account ActsAccountDeleteAccount_0700 err:
"
+
JSON
.
stringify
(
err
));
var
appAccountManager
=
account
.
createAppAccountManager
();
appAccountManager
.
deleteAccount
(
bigStr
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account ActsAccountDeleteAccount_0700 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountDeleteAccount_0700 end====
"
);
done
();
}
}
);
});
/*
* @tc.number : ActsAccountDeleteAccount_0800
* @tc.name : Delete account promise form
* @tc.desc : Delete the a
dded account, the first time it can be deleted, the second time the deletion fails
* @tc.desc : Delete the a
ccount name exceeds the length limit of 1024
*/
it
(
'
ActsAccountDeleteAccount_0800
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsAccountDeleteAccount_0800 start====
"
);
var
bigStr
=
''
;
for
(
var
i
=
0
;
i
<
STRCOUNT
;
i
++
)
{
bigStr
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>add account ActsAccountAddAccount_0800 start====
"
);
await
appAccountManager
.
addAccount
(
"
deleteAccount_name_promise_third
"
,
"
extraInfo_promise_third
"
);
console
.
debug
(
"
====>delete Account first time ActsAccountDeleteAccount_0800 start====
"
);
await
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_promise_third
"
);
console
.
debug
(
"
====>delete Account second time ActsAccountDeleteAccount_0800 start====
"
);
console
.
debug
(
"
====>delete Account ActsAccountDeleteAccount_0800 start====
"
);
try
{
await
appAccountManager
.
deleteAccount
(
"
deleteAccount_name_promise_third
"
);
await
appAccountManager
.
deleteAccount
(
bigStr
);
}
catch
(
err
){
console
.
debug
(
"
====>delete account ActsAccountDeleteAccount_0
7
00 err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>delete account ActsAccountDeleteAccount_0
8
00 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountDeleteAccount_0
7
00 end====
"
);
console
.
debug
(
"
====>ActsAccountDeleteAccount_0
8
00 end====
"
);
done
();
}
})
;
})
/*
* @tc.number : ActsAccountDeleteAccount_0900
* @tc.name : Delete account
promise
form
* @tc.desc : Delete the account name
exceeds the length limit of 1024
* @tc.name : Delete account
calllback
form
* @tc.desc : Delete the account name
is an empty string
*/
it
(
'
ActsAccountDeleteAccount_0900
'
,
0
,
async
function
(
done
){
it
(
'
ActsAccountDeleteAccount_0900
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsAccountDeleteAccount_0900 start====
"
);
var
bigStr
=
''
;
for
(
var
i
=
0
;
i
<
STRCOUNT
;
i
++
)
{
bigStr
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>delete Account ActsAccountDeleteAccount_0900 start====
"
);
try
{
await
appAccountManager
.
deleteAccount
(
bigStr
);
}
catch
(
err
){
console
.
debug
(
"
====>delete account ActsAccountDeleteAccount_0900 err:
"
+
JSON
.
stringify
(
err
));
appAccountManager
.
deleteAccount
(
""
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account ActsAccountDeleteAccount_0900 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountDeleteAccount_0900 end====
"
);
done
();
}
})
}
);
})
;
/*
* @tc.number : ActsAccountDeleteAccount_1000
...
...
account/appaccount/actsaccounttest/entry/src/main/js/test/ExtraInfo.test.js
浏览文件 @
76f3099f
...
...
@@ -15,7 +15,7 @@
import
account
from
'
@ohos.account.appAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUT
=
1000
0
;
const
TIMEOUT
=
1000
;
describe
(
'
ActsAccountSetGetExtraInfo
'
,
function
()
{
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
...
...
account/appaccount/actsaccounttest/entry/src/main/js/test/NoPermission.test.js
浏览文件 @
76f3099f
...
...
@@ -15,7 +15,7 @@
import
account
from
'
@ohos.account.appAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUT
=
1000
0
;
const
TIMEOUT
=
1000
;
const
ERR_APPACCOUNT_SERVICE_PERMISSION_DENIED
=
4521990
;
describe
(
'
ActsAccountNoPermission
'
,
function
()
{
function
sleep
(
delay
)
{
...
...
account/appaccount/actsaccounttest/entry/src/main/js/test/OAuthToken.test.js
浏览文件 @
76f3099f
...
...
@@ -15,7 +15,8 @@
import
account
from
'
@ohos.account.appAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUT
=
10000
;
const
TIMEOUT
=
1000
;
const
LENGTHLIMIT
=
1024
;
describe
(
'
ActsAccountOAuthToken
'
,
function
()
{
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
...
...
@@ -559,4 +560,348 @@ describe('ActsAccountOAuthToken', function () {
console
.
debug
(
"
====>ActsAccountOAuthToken_2000 end====
"
);
done
();
});
/*
* @tc.number : ActsAccountOAuthToken_2100
* @tc.name : Test oauth token in callback form
* @tc.desc : Get the token after setting the token to an empty string
*/
it
(
'
ActsAccountOAuthToken_2100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_2100 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
appAccountManager
.
addAccount
(
"
account_callback_empty
"
,
(
err
)
=>
{
console
.
debug
(
"
====>add account ActsAccountOAuthToken_2100 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
setOAuthToken
(
"
account_callback_empty
"
,
""
,
(
err
)
=>
{
console
.
debug
(
"
====>setOAuthToken 2100 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
getOAuthToken
(
"
account_callback_empty
"
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>getOAuthToken 2100 err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>getOAuthToken 2100 data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertEqual
(
""
);
appAccountManager
.
deleteAccount
(
"
account_callback_empty
"
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account 2100 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
console
.
debug
(
"
====>ActsAccountOAuthToken_2100 end====
"
);
done
();
});
});
});
});
});
/*
* @tc.number : ActsAccountOAuthToken_2200
* @tc.name : Test oauth token in promise form
* @tc.desc : Get the token after setting the token to an empty string
*/
it
(
'
ActsAccountOAuthToken_2200
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_2200 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
console
.
debug
(
"
====>add account ActsAccountOAuthToken_2200 start====
"
);
await
appAccountManager
.
addAccount
(
"
accountToken_promise_empty
"
);
console
.
debug
(
"
====>setOAuthToken 2200 start====
"
);
await
appAccountManager
.
setOAuthToken
(
"
accountToken_promise_empty
"
,
""
);
console
.
debug
(
"
====>getOAuthToken ActsAccountOAuthToken_2200 start====
"
);
var
data
=
await
appAccountManager
.
getOAuthToken
(
"
accountToken_promise_empty
"
);
expect
(
data
).
assertEqual
(
""
);
await
appAccountManager
.
deleteAccount
(
"
accountToken_promise_empty
"
);
console
.
debug
(
"
====>ActsAccountOAuthToken_2000 end====
"
);
done
();
});
/*
* @tc.number : ActsAccountOAuthToken_2300
* @tc.name : Test oauth token in callback form
* @tc.desc : Get the token after setting the token to a space string
*/
it
(
'
ActsAccountOAuthToken_2300
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_2300 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
appAccountManager
.
addAccount
(
"
account_callback_space
"
,
(
err
)
=>
{
console
.
debug
(
"
====>add account ActsAccountOAuthToken_2300 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
setOAuthToken
(
"
account_callback_space
"
,
"
"
,
(
err
)
=>
{
console
.
debug
(
"
====>setOAuthToken 2300 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
getOAuthToken
(
"
account_callback_space
"
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>getOAuthToken 2300 err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>getOAuthToken 2300 data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertEqual
(
"
"
);
appAccountManager
.
deleteAccount
(
"
account_callback_space
"
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account 2300 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
console
.
debug
(
"
====>ActsAccountOAuthToken_2300 end====
"
);
done
();
});
});
});
});
});
/*
* @tc.number : ActsAccountOAuthToken_2400
* @tc.name : Test oauth token in promise form
* @tc.desc : Get the token after setting the token to a space string
*/
it
(
'
ActsAccountOAuthToken_2400
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_2400 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
console
.
debug
(
"
====>add account ActsAccountOAuthToken_2400 start====
"
);
await
appAccountManager
.
addAccount
(
"
accountToken_promise_space
"
);
console
.
debug
(
"
====>setOAuthToken 2400 start====
"
);
await
appAccountManager
.
setOAuthToken
(
"
accountToken_promise_space
"
,
"
"
);
console
.
debug
(
"
====>getOAuthToken ActsAccountOAuthToken_2400 start====
"
);
var
data
=
await
appAccountManager
.
getOAuthToken
(
"
accountToken_promise_space
"
);
expect
(
data
).
assertEqual
(
"
"
);
await
appAccountManager
.
deleteAccount
(
"
accountToken_promise_space
"
);
console
.
debug
(
"
====>ActsAccountOAuthToken_2400 end====
"
);
done
();
});
/*
* @tc.number : ActsAccountOAuthToken_2500
* @tc.name : Test oauth token in callback form
* @tc.desc : Set the length of the token to exceed the length limit of 1024 characters
*/
it
(
'
ActsAccountOAuthToken_2500
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_2500 start====
"
);
var
limitToken
=
''
;
for
(
var
i
=
0
;
i
<
LENGTHLIMIT
+
1
;
i
++
)
{
limitToken
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
appAccountManager
.
addAccount
(
"
account_callback_lengthlimit
"
,
(
err
)
=>
{
console
.
debug
(
"
====>add account ActsAccountOAuthToken_2500 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
setOAuthToken
(
"
account_callback_lengthlimit
"
,
limitToken
,
(
err
)
=>
{
console
.
debug
(
"
====>setOAuthToken 2500 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
appAccountManager
.
deleteAccount
(
"
account_callback_lengthlimit
"
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account 2500 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
console
.
debug
(
"
====>ActsAccountOAuthToken_2500 end====
"
);
done
();
});
});
});
});
/*
* @tc.number : ActsAccountOAuthToken_2600
* @tc.name : Test oauth token in promise form
* @tc.desc : Set the length of the token to exceed the length limit of 1024 characters
*/
it
(
'
ActsAccountOAuthToken_2600
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_2600 start====
"
);
var
limitToken
=
''
;
for
(
var
i
=
0
;
i
<
LENGTHLIMIT
+
1
;
i
++
)
{
limitToken
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
console
.
debug
(
"
====>add account ActsAccountOAuthToken_2600 start====
"
);
await
appAccountManager
.
addAccount
(
"
account_promise_lengthlimit
"
);
console
.
debug
(
"
====>setOAuthToken 2600 start====
"
);
try
{
await
appAccountManager
.
setOAuthToken
(
"
account_promise_lengthlimit
"
,
limitToken
);
}
catch
(
err
){
console
.
debug
(
"
====>setOAuthToken ActsAccountOAuthToken_2600 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>delete account ActsAccountOAuthToken_2600 start====
"
);
await
appAccountManager
.
deleteAccount
(
"
account_promise_lengthlimit
"
);
console
.
debug
(
"
====>ActsAccountOAuthToken_2600 end====
"
);
done
();
}
});
/*
* @tc.number : ActsAccountOAuthToken_2700
* @tc.name : Test oauth token in callback form
* @tc.desc : Set the length of the token to just reach the length limit of 1024 characters
*/
it
(
'
ActsAccountOAuthToken_2700
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_2700 start====
"
);
var
tokenLimit
=
''
;
for
(
var
i
=
0
;
i
<
LENGTHLIMIT
;
i
++
)
{
tokenLimit
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
appAccountManager
.
addAccount
(
"
account_callback_limit
"
,
(
err
)
=>
{
console
.
debug
(
"
====>add account ActsAccountOAuthToken_2700 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
setOAuthToken
(
"
account_callback_limit
"
,
tokenLimit
,
(
err
)
=>
{
console
.
debug
(
"
====>setOAuthToken 2700 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
appAccountManager
.
getOAuthToken
(
"
account_callback_limit
"
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>getOAuthToken 2700 err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>getOAuthToken 2700 data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertEqual
(
tokenLimit
);
appAccountManager
.
deleteAccount
(
"
account_callback_limit
"
,
(
err
)
=>
{
console
.
debug
(
"
====>delete Account 2700 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
console
.
debug
(
"
====>ActsAccountOAuthToken_2700 end====
"
);
done
();
});
});
});
});
});
/*
* @tc.number : ActsAccountOAuthToken_2800
* @tc.name : Test oauth token in promise form
* @tc.desc : Set the length of the token to just reach the length limit of 1024 characters
*/
it
(
'
ActsAccountOAuthToken_2800
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_2800 start====
"
);
var
tokenLimit
=
''
;
for
(
var
i
=
0
;
i
<
LENGTHLIMIT
;
i
++
)
{
tokenLimit
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
console
.
debug
(
"
====>add account ActsAccountOAuthToken_2800 start====
"
);
await
appAccountManager
.
addAccount
(
"
accountToken_promise_limit
"
);
console
.
debug
(
"
====>setOAuthToken 2400 start====
"
);
await
appAccountManager
.
setOAuthToken
(
"
accountToken_promise_limit
"
,
tokenLimit
);
console
.
debug
(
"
====>getOAuthToken ActsAccountOAuthToken_2800 start====
"
);
var
data
=
await
appAccountManager
.
getOAuthToken
(
"
accountToken_promise_limit
"
);
expect
(
data
).
assertEqual
(
tokenLimit
);
await
appAccountManager
.
deleteAccount
(
"
accountToken_promise_limit
"
);
console
.
debug
(
"
====>ActsAccountOAuthToken_2800 end====
"
);
done
();
});
/*
* @tc.number : ActsAccountOAuthToken_2900
* @tc.name : Test oauth token in callback form
* @tc.desc : Clear token parameter name is an empty string
*/
it
(
'
ActsAccountOAuthToken_2900
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_2900 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
appAccountManager
.
clearOAuthToken
(
""
,
(
err
)
=>
{
console
.
debug
(
"
====>clearOAuthToken 2900 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountOAuthToken_1900 end====
"
);
done
();
});
});
/*
* @tc.number : ActsAccountOAuthToken_3000
* @tc.name : Test oauth token in promise form
* @tc.desc : Clear token parameter name is an empty string
*/
it
(
'
ActsAccountOAuthToken_3000
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_3000 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
console
.
debug
(
"
====>clearOAuthToken 3000 start====
"
);
try
{
await
appAccountManager
.
clearOAuthToken
(
""
);
}
catch
(
err
){
console
.
debug
(
"
====>clearOAuthToken ActsAccountOAuthToken_3000 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountOAuthToken_3000 end====
"
);
done
();
}
});
/*
* @tc.number : ActsAccountOAuthToken_3100
* @tc.name : Test oauth token in callback form
* @tc.desc : The clear token parameter name is a space string
*/
it
(
'
ActsAccountOAuthToken_3100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_3100 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
appAccountManager
.
clearOAuthToken
(
"
"
,
(
err
)
=>
{
console
.
debug
(
"
====>clearOAuthToken 3100 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountOAuthToken_3100 end====
"
);
done
();
});
});
/*
* @tc.number : ActsAccountOAuthToken_3200
* @tc.name : Test oauth token in promise form
* @tc.desc : The clear token parameter name is a space string
*/
it
(
'
ActsAccountOAuthToken_3200
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_3200 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
console
.
debug
(
"
====>clearOAuthToken 3200 start====
"
);
try
{
await
appAccountManager
.
clearOAuthToken
(
"
"
);
}
catch
(
err
){
console
.
debug
(
"
====>clearOAuthToken ActsAccountOAuthToken_3200 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountOAuthToken_3200 end====
"
);
done
();
}
});
/*
* @tc.number : ActsAccountOAuthToken_3300
* @tc.name : Test oauth token in callback form
* @tc.desc : Clear the token parameter name exceeds the length limit of 1024 characters
*/
it
(
'
ActsAccountOAuthToken_3300
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_3300 start====
"
);
var
nameLimit
=
''
;
for
(
var
i
=
0
;
i
<
LENGTHLIMIT
+
1
;
i
++
)
{
nameLimit
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
appAccountManager
.
clearOAuthToken
(
nameLimit
,
(
err
)
=>
{
console
.
debug
(
"
====>clearOAuthToken first 3300 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountOAuthToken_3300 end====
"
);
done
();
});
});
/*
* @tc.number : ActsAccountOAuthToken_3400
* @tc.name : Test oauth token in promise form
* @tc.desc : Clear the token parameter name exceeds the length limit of 1024 characters
*/
it
(
'
ActsAccountOAuthToken_3400
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsAccountOAuthToken_3400 start====
"
);
var
nameLimit
=
''
;
for
(
var
i
=
0
;
i
<
LENGTHLIMIT
+
1
;
i
++
)
{
nameLimit
+=
'
t
'
;
}
var
appAccountManager
=
account
.
createAppAccountManager
();
console
.
debug
(
"
====>creat finish====
"
);
console
.
debug
(
"
====>clearOAuthToken first 3400 start====
"
);
try
{
await
appAccountManager
.
clearOAuthToken
(
nameLimit
);
}
catch
(
err
){
console
.
debug
(
"
====>clearOAuthToken ActsAccountOAuthToken_3400 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsAccountOAuthToken_3400 end====
"
);
done
();
}
});
})
\ No newline at end of file
account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/js/default/pages/index/index.js
浏览文件 @
76f3099f
...
...
@@ -36,26 +36,158 @@ export default {
console
.
debug
(
"
====>scene off finish====
"
);
});
}
function
changeOn
CallbackFirst
(
data
){
function
changeOn
Extra
(
data
){
console
.
debug
(
"
====>receive change 0100 data:
"
+
JSON
.
stringify
(
data
));
try
{
if
(
data
[
0
].
owner
==
"
com.example.actsaccountchangeonoff
"
&&
data
[
0
].
name
==
"
changeonoff_
first
"
){
if
(
data
[
0
].
owner
==
"
com.example.actsaccountchangeonoff
"
&&
data
[
0
].
name
==
"
changeonoff_
extra
"
){
var
commonEventPublishData
=
{
data
:
"
SUCCESS
"
}
commonevent
.
publish
(
"
account_on_change_
first
"
,
commonEventPublishData
,
publishCallback
);
commonevent
.
publish
(
"
account_on_change_
extra
"
,
commonEventPublishData
,
publishCallback
);
}
else
{
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_change_
first
"
,
commonEventPublishData
,
publishCallback
);
commonevent
.
publish
(
"
account_on_change_
extra
"
,
commonEventPublishData
,
publishCallback
);
}
}
catch
(
err
){
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_change_first
"
,
commonEventPublishData
,
publishCallback
);
commonevent
.
publish
(
"
account_on_change_extra
"
,
commonEventPublishData
,
publishCallback
);
}
}
function
changeOnAssociateData
(
data
){
console
.
debug
(
"
====>receive change 0200 data:
"
+
JSON
.
stringify
(
data
));
try
{
if
(
data
[
0
].
owner
==
"
com.example.actsaccountchangeonoff
"
&&
data
[
0
].
name
==
"
onoff_associatedata
"
){
var
commonEventPublishData
=
{
data
:
"
SUCCESS
"
}
commonevent
.
publish
(
"
account_on_change_associatedata
"
,
commonEventPublishData
,
publishCallback
);
}
else
{
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_change_associatedata
"
,
commonEventPublishData
,
publishCallback
);
}
}
catch
(
err
){
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_change_associatedata
"
,
commonEventPublishData
,
publishCallback
);
}
}
function
changeOnCredential
(
data
){
console
.
debug
(
"
====>receive change 0300 data:
"
+
JSON
.
stringify
(
data
));
try
{
if
(
data
[
0
].
owner
==
"
com.example.actsaccountchangeonoff
"
&&
data
[
0
].
name
==
"
onoff_credential
"
){
var
commonEventPublishData
=
{
data
:
"
SUCCESS
"
}
commonevent
.
publish
(
"
account_on_change_credential
"
,
commonEventPublishData
,
publishCallback
);
}
else
{
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_change_credential
"
,
commonEventPublishData
,
publishCallback
);
}
}
catch
(
err
){
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_change_credential
"
,
commonEventPublishData
,
publishCallback
);
}
}
function
changeOnDeleteAnother
(
data
){
console
.
debug
(
"
====>receive change 0400 data:
"
+
JSON
.
stringify
(
data
));
try
{
if
(
data
[
0
].
owner
==
"
com.example.actsaccountchangeonoff
"
&&
data
[
0
].
name
==
"
onoff_deleteFir
"
){
var
commonEventPublishData
=
{
data
:
"
SUCCESS
"
}
commonevent
.
publish
(
"
account_on_delete_another
"
,
commonEventPublishData
,
publishCallback
);
}
else
{
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_delete_another
"
,
commonEventPublishData
,
publishCallback
);
}
}
catch
(
err
){
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_delete_another
"
,
commonEventPublishData
,
publishCallback
);
}
}
function
changeOnDelete
(
data
){
console
.
debug
(
"
====>receive change 0500 data:
"
+
JSON
.
stringify
(
data
));
try
{
if
(
data
.
length
==
0
){
var
commonEventPublishData
=
{
data
:
"
SUCCESS
"
}
commonevent
.
publish
(
"
account_on_change_delete
"
,
commonEventPublishData
,
publishCallback
);
}
else
{
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_change_delete
"
,
commonEventPublishData
,
publishCallback
);
}
}
catch
(
err
){
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_change_delete
"
,
commonEventPublishData
,
publishCallback
);
}
}
function
changeOnDisableAnother
(
data
){
console
.
debug
(
"
====>receive change 0600 data:
"
+
JSON
.
stringify
(
data
));
try
{
if
(
data
[
0
].
owner
==
"
com.example.actsaccountchangeonoff
"
&&
data
[
0
].
name
==
"
onoff_enableFir
"
){
var
commonEventPublishData
=
{
data
:
"
SUCCESS
"
}
commonevent
.
publish
(
"
account_on_disable_another
"
,
commonEventPublishData
,
publishCallback
);
}
else
{
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_disable_another
"
,
commonEventPublishData
,
publishCallback
);
}
}
catch
(
err
){
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_disable_another
"
,
commonEventPublishData
,
publishCallback
);
}
}
function
changeOnDisable
(
data
){
console
.
debug
(
"
====>receive change 0700 data:
"
+
JSON
.
stringify
(
data
));
try
{
if
(
data
.
length
==
0
){
var
commonEventPublishData
=
{
data
:
"
SUCCESS
"
}
commonevent
.
publish
(
"
account_on_change_disable
"
,
commonEventPublishData
,
publishCallback
);
}
else
{
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_change_disable
"
,
commonEventPublishData
,
publishCallback
);
}
}
catch
(
err
){
var
commonEventPublishData
=
{
data
:
"
FAIL
"
}
commonevent
.
publish
(
"
account_on_change_disable
"
,
commonEventPublishData
,
publishCallback
);
}
}
function
subscriberCallback
(
err
,
data
){
...
...
@@ -64,13 +196,36 @@ export default {
switch
(
data
.
code
){
case
1
:
console
.
debug
(
"
====>receive event 0100 event:
"
+
data
.
event
);
appAccountManager
.
on
(
'
change
'
,
[
"
com.example.actsaccountchangeonoff
"
],
changeOnCallbackFirst
);
appAccountManager
.
on
(
'
change
'
,
[
"
com.example.actsaccountchangeonoff
"
],
changeOnExtra
);
break
;
case
2
:
console
.
debug
(
"
====>receive event 0200 event:
"
+
data
.
event
);
appAccountManager
.
on
(
'
change
'
,
[
"
com.example.actsaccountchangeonoff
"
],
changeOnAssociateData
);
break
;
case
3
:
console
.
debug
(
"
====>receive event 0300 event:
"
+
data
.
event
);
appAccountManager
.
on
(
'
change
'
,
[
"
com.example.actsaccountchangeonoff
"
],
changeOnCredential
);
break
;
case
4
:
console
.
debug
(
"
====>receive event 0400 event:
"
+
data
.
event
);
appAccountManager
.
on
(
'
change
'
,
[
"
com.example.actsaccountchangeonoff
"
],
changeOnDeleteAnother
);
break
;
case
5
:
console
.
debug
(
"
====>receive event 0500 event:
"
+
data
.
event
);
appAccountManager
.
on
(
'
change
'
,
[
"
com.example.actsaccountchangeonoff
"
],
changeOnDelete
);
break
;
case
6
:
console
.
debug
(
"
====>receive event 0600 event:
"
+
data
.
event
);
appAccountManager
.
on
(
'
change
'
,
[
"
com.example.actsaccountchangeonoff
"
],
changeOnDisableAnother
);
break
;
case
7
:
console
.
debug
(
"
====>receive event 0700 event:
"
+
data
.
event
);
appAccountManager
.
on
(
'
change
'
,
[
"
com.example.actsaccountchangeonoff
"
],
changeOnDisable
);
break
;
default
:
console
.
debug
(
"
====>receive event enter default====
"
);
break
;
}
}
var
subscriber
commonevent
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
){
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录