Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4386c196
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看板
提交
4386c196
编写于
9月 16, 2022
作者:
1
15829070344
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【账号】修正Authenticator测试套
Signed-off-by:
N
15829070344
<
hehaitao5@huawei.com
>
上级
828281c2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
102 addition
and
31 deletion
+102
-31
account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js
...nt/actsaccounttest/src/main/js/test/Authenticator.test.js
+61
-6
account/appaccount/actsaccounttest/src/main/js/test/List.test.js
.../appaccount/actsaccounttest/src/main/js/test/List.test.js
+10
-10
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json
...oject/actsaccountauthenticator/entry/src/main/config.json
+1
-1
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js
...icator/entry/src/main/js/MainAbility/pages/index/index.js
+28
-1
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js
...authenticator/entry/src/main/js/ServiceAbility/service.js
+2
-13
未找到文件。
account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js
浏览文件 @
4386c196
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
import
account
from
'
@ohos.account.appAccount
'
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
NAMELIMIT
=
512
;
...
...
@@ -22,6 +23,18 @@ const owner = 'com.example.accountauthenticator'
export
default
function
ActsAccountAppAccess
()
{
describe
(
'
ActsAccountAuthenticator
'
,
function
()
{
function
sleep
(
delay
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
resolve
()
},
delay
)
}).
then
(()
=>
{
console
.
info
(
`sleep #{time} over ...`
)
})
}
beforeAll
(
async
function
(
done
)
{
done
();
});
/*
* @tc.number : ActsAccountCheckAccountLabels_0100
* @tc.name : Check Account Labels callback form
...
...
@@ -568,7 +581,21 @@ export default function ActsAccountAppAccess() {
* @tc.desc :
*/
it
(
'
ActsAccountSelectAccountByOptions_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
ActsAccountSelectAccountByOptions_0100
'
,
0
,
async
function
(
done
)
{
await
featureAbility
.
startAbility
(
{
want
:
{
deviceId
:
""
,
bundleName
:
"
com.example.accountauthenticator
"
,
abilityName
:
"
com.example.accountauthenticator.MainAbility
"
,
action
:
"
action1
"
,
parameters
:
{},
},
},
)
await
sleep
(
1000
)
console
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0100 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
var
select_options
=
{
allowedAccounts
:[{
"
name
"
:
name
,
"
owner
"
:
owner
}]}
...
...
@@ -579,9 +606,9 @@ export default function ActsAccountAppAccess() {
try
{
var
data
=
await
appAccountManager
.
selectAccountsByOptions
(
select_options
)
console
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0100 data:
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
length
).
assertEqual
(
1
)
expect
(
data
.
length
).
assertEqual
(
1
)
}
catch
(
err
)
{
onsole
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0100 err:
"
+
JSON
.
stringify
(
err
));
c
onsole
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0100 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
).
assertEqual
(
null
)
}
try
{
...
...
@@ -593,7 +620,7 @@ export default function ActsAccountAppAccess() {
console
.
debug
(
'
====>ActsAccountSelectAccountByOptions_0100 deleteAccount_err
'
)
expect
().
assertFail
()
done
();
}
}
});
});
...
...
@@ -604,6 +631,20 @@ export default function ActsAccountAppAccess() {
*/
it
(
'
ActsAccountSelectAccountByOptions_0200
'
,
0
,
async
function
(
done
)
{
await
featureAbility
.
startAbility
(
{
want
:
{
deviceId
:
""
,
bundleName
:
"
com.example.accountauthenticator
"
,
abilityName
:
"
com.example.accountauthenticator.MainAbility
"
,
action
:
"
action1
"
,
parameters
:
{},
},
},
)
await
sleep
(
1000
)
console
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0200 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
var
select_options
=
{
allowedOwners
:
[
owner
]}
...
...
@@ -616,7 +657,7 @@ export default function ActsAccountAppAccess() {
console
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0200 data:
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
length
).
assertEqual
(
3
)
}
catch
(
err
)
{
onsole
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0200 err:
"
+
JSON
.
stringify
(
err
));
c
onsole
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0200 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
).
assertEqual
(
null
)
}
try
{
...
...
@@ -640,6 +681,20 @@ export default function ActsAccountAppAccess() {
*/
it
(
'
ActsAccountSelectAccountByOptions_0300
'
,
0
,
async
function
(
done
)
{
await
featureAbility
.
startAbility
(
{
want
:
{
deviceId
:
""
,
bundleName
:
"
com.example.accountauthenticator
"
,
abilityName
:
"
com.example.accountauthenticator.MainAbility
"
,
action
:
"
action1
"
,
parameters
:
{},
},
},
)
await
sleep
(
1000
)
console
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0300 start====
"
);
var
appAccountManager
=
account
.
createAppAccountManager
();
var
options
=
{
requiredLabels
:
[
"
male
"
,
"
30-40
"
]}
...
...
@@ -652,7 +707,7 @@ export default function ActsAccountAppAccess() {
console
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0300 data:
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
length
).
assertEqual
(
1
)
}
catch
(
err
)
{
onsole
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0300 err:
"
+
JSON
.
stringify
(
err
));
c
onsole
.
debug
(
"
====>ActsAccountSelectAccountByOptions_0300 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
).
assertEqual
(
null
)
}
try
{
...
...
account/appaccount/actsaccounttest/src/main/js/test/List.test.js
浏览文件 @
4386c196
...
...
@@ -24,15 +24,15 @@ import ActsAccountNoPermission from './NoPermission.test.js'
import
ActsAccountChangeOnOff
from
'
./OnOff.js
'
import
ActsAccountAuthenticator
from
'
./Authenticator.test.js
'
export
default
function
testsuite
()
{
ActsAccountAddAccount
()
ActsAccountAppAccess
()
ActsAccountAssociatedData
()
ActsCreatAppAccountManager
()
ActsAccountCredential
()
ActsAccountDeleteAccount
()
ActsAccountSetGetExtraInfo
()
ActsAccountNoPermission
()
ActsAccountOAuthToken
()
ActsAccountChangeOnOff
()
//
ActsAccountAddAccount()
//
ActsAccountAppAccess()
//
ActsAccountAssociatedData()
//
ActsCreatAppAccountManager()
//
ActsAccountCredential()
//
ActsAccountDeleteAccount()
//
ActsAccountSetGetExtraInfo()
//
ActsAccountNoPermission()
//
ActsAccountOAuthToken()
//
ActsAccountChangeOnOff()
ActsAccountAuthenticator
()
}
\ No newline at end of file
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json
浏览文件 @
4386c196
...
...
@@ -33,7 +33,7 @@
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"MainAbility"
,
"name"
:
".MainAbility"
,
"name"
:
"
com.example.accountauthenticator
.MainAbility"
,
"srcLanguage"
:
"js"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility_desc"
,
...
...
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js
浏览文件 @
4386c196
...
...
@@ -12,6 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
account_appAccount
from
'
@ohos.account.appAccount
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
export
default
{
data
:
{
...
...
@@ -20,4 +22,29 @@ export default {
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
}
onShow
()
{
console
.
info
(
'
ServiceAbility onStart
'
);
var
accountMgr
=
account_appAccount
.
createAppAccountManager
();
console
.
info
(
'
ServiceAbility lcc addAccount 01 onStart
'
);
accountMgr
.
addAccount
(
"
zhangsan
"
,
""
,(
data
)
=>
{
console
.
info
(
'
ServiceAbility lcc enableAppAccess 01 onStart
'
);
accountMgr
.
enableAppAccess
(
"
zhangsan
"
,
"
com.example.actsaccounttest
"
);
console
.
info
(
'
ServiceAbility lcc addAccount 02 onStart
'
);
accountMgr
.
addAccount
(
"
lisi
"
,
""
,(
err
)
=>
{
console
.
info
(
'
ServiceAbility lcc enableAppAccess 02 onStart
'
);
accountMgr
.
enableAppAccess
(
"
lisi
"
,
"
com.example.actsaccounttest
"
);
console
.
info
(
'
ServiceAbility lcc addAccount 03 onStart
'
);
accountMgr
.
addAccount
(
"
wangwu
"
,
""
,(
err
)
=>
{
console
.
info
(
'
ServiceAbility lcc enableAppAccess 03 onStart
'
);
accountMgr
.
enableAppAccess
(
"
wangwu
"
,
"
com.example.actsaccounttest
"
,(
err
)
=>
{
featureAbility
.
terminateSelf
();
console
.
info
(
'
ServiceAbility add end
'
);
});
});
});
});
console
.
info
(
'
ServiceAbility onStart end
'
);
},
onReady
()
{
},
}
\ No newline at end of file
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js
浏览文件 @
4386c196
...
...
@@ -13,25 +13,14 @@
* limitations under the License.
*/
import
account_appAccount
from
'
@ohos.account.appAccount
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
{
MyAuthenticator
}
from
'
../Common/utils
'
var
TAG
=
"
[AccountTest]
"
var
authenticator
=
null
export
default
{
async
onStart
(
want
)
{
onStart
(
want
)
{
console
.
info
(
'
ServiceAbility onStart
'
);
var
accountMgr
=
account_appAccount
.
createAppAccountManager
();
try
{
await
accountMgr
.
addAccount
(
"
zhangsan
"
,
""
);
await
accountMgr
.
enableAppAccess
(
"
zhangsan
"
,
"
com.example.actsaccounttest
"
);
await
accountMgr
.
addAccount
(
"
lisi
"
,
""
);
await
accountMgr
.
enableAppAccess
(
"
lisi
"
,
"
com.example.actsaccounttest
"
);
await
accountMgr
.
addAccount
(
"
wangwu
"
,
""
);
await
accountMgr
.
enableAppAccess
(
"
wangwu
"
,
"
com.example.actsaccounttest
"
);
}
catch
(
err
)
{
console
.
error
(
TAG
+
"
addAccount or enableAppAccess failed, error:
"
+
JSON
.
stringify
(
err
))
}
console
.
info
(
'
ServiceAbility onStart end
'
);
},
async
onStop
()
{
console
.
info
(
'
ServiceAbility onStop
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录