Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
33df8ab1
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看板
提交
33df8ab1
编写于
1月 10, 2022
作者:
G
gaoxi785
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update xts osaccount test
Signed-off-by:
N
gaoxi785
<
gaoxi785@huawei.com
>
上级
79f25b6b
变更
32
显示空白变更内容
内联
并排
Showing
32 changed file
with
1786 addition
and
0 deletion
+1786
-0
account/BUILD.gn
account/BUILD.gn
+1
-0
account/osaccount/BUILD.gn
account/osaccount/BUILD.gn
+24
-0
account/osaccount/actsosaccountsystemtest/BUILD.gn
account/osaccount/actsosaccountsystemtest/BUILD.gn
+31
-0
account/osaccount/actsosaccountsystemtest/Test.json
account/osaccount/actsosaccountsystemtest/Test.json
+18
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/config.json
...ccount/actsosaccountsystemtest/entry/src/main/config.json
+83
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/app.js
.../actsosaccountsystemtest/entry/src/main/js/default/app.js
+22
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/i18n/en-US.json
...countsystemtest/entry/src/main/js/default/i18n/en-US.json
+6
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/i18n/zh-CN.json
...countsystemtest/entry/src/main/js/default/i18n/zh-CN.json
+6
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/pages/index/index.css
...ystemtest/entry/src/main/js/default/pages/index/index.css
+12
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/pages/index/index.hml
...ystemtest/entry/src/main/js/default/pages/index/index.hml
+8
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/pages/index/index.js
...systemtest/entry/src/main/js/default/pages/index/index.js
+45
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/resources/base/element/string.json
...test/entry/src/main/js/resources/base/element/string.json
+12
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/resources/base/media/icon.png
...ystemtest/entry/src/main/js/resources/base/media/icon.png
+0
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/Activate.test.js
...accountsystemtest/entry/src/main/js/test/Activate.test.js
+405
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/List.test.js
...tsosaccountsystemtest/entry/src/main/js/test/List.test.js
+17
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/OnOff.test.js
...sosaccountsystemtest/entry/src/main/js/test/OnOff.test.js
+135
-0
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/Query.test.js
...sosaccountsystemtest/entry/src/main/js/test/Query.test.js
+336
-0
account/osaccount/actsosaccountsystemtest/signature/openharmony_sx.p7b
...ount/actsosaccountsystemtest/signature/openharmony_sx.p7b
+0
-0
account/osaccount/actsosaccountthirdpartytest/BUILD.gn
account/osaccount/actsosaccountthirdpartytest/BUILD.gn
+31
-0
account/osaccount/actsosaccountthirdpartytest/Test.json
account/osaccount/actsosaccountthirdpartytest/Test.json
+18
-0
account/osaccount/actsosaccountthirdpartytest/entry/src/main/config.json
...nt/actsosaccountthirdpartytest/entry/src/main/config.json
+83
-0
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/app.js
...sosaccountthirdpartytest/entry/src/main/js/default/app.js
+22
-0
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/i18n/en-US.json
...tthirdpartytest/entry/src/main/js/default/i18n/en-US.json
+6
-0
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/i18n/zh-CN.json
...tthirdpartytest/entry/src/main/js/default/i18n/zh-CN.json
+6
-0
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.css
...partytest/entry/src/main/js/default/pages/index/index.css
+12
-0
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.hml
...partytest/entry/src/main/js/default/pages/index/index.hml
+8
-0
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.js
...dpartytest/entry/src/main/js/default/pages/index/index.js
+45
-0
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/resources/base/element/string.json
...test/entry/src/main/js/resources/base/element/string.json
+12
-0
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/resources/base/media/icon.png
...partytest/entry/src/main/js/resources/base/media/icon.png
+0
-0
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/test/List.test.js
...accountthirdpartytest/entry/src/main/js/test/List.test.js
+15
-0
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/test/OsAccountIs.test.js
...thirdpartytest/entry/src/main/js/test/OsAccountIs.test.js
+367
-0
account/osaccount/actsosaccountthirdpartytest/signature/openharmony_sx.p7b
.../actsosaccountthirdpartytest/signature/openharmony_sx.p7b
+0
-0
未找到文件。
account/BUILD.gn
浏览文件 @
33df8ab1
...
...
@@ -18,6 +18,7 @@ group("account") {
deps = [
"OsAccountTest_js:ActsOsAccountJSApiTest",
"appaccount:appaccount_hap",
"osaccount:osaccount_hap",
]
} else {
deps = []
...
...
account/osaccount/BUILD.gn
0 → 100644
浏览文件 @
33df8ab1
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
group("osaccount_hap") {
testonly = true
if (is_standard_system) {
deps = [
"actsosaccountsystemtest:ActsOsAccountSystemTest",
"actsosaccountthirdpartytest:ActsOsAccountThirdPartyTest",
]
}
}
account/osaccount/actsosaccountsystemtest/BUILD.gn
0 → 100755
浏览文件 @
33df8ab1
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsOsAccountSystemTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsOsAccountSystemTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
account/osaccount/actsosaccountsystemtest/Test.json
0 → 100755
浏览文件 @
33df8ab1
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"200000"
,
"package"
:
"com.example.actsosaccountsystemtest"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsOsAccountSystemTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
account/osaccount/actsosaccountsystemtest/entry/src/main/config.json
0 → 100755
浏览文件 @
33df8ab1
{
"app"
:
{
"bundleName"
:
"com.example.actsosaccountsystemtest"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.example.actsosaccountsystemtest"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"defPermissions"
:
[
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"ohos.permission.MANAGE_LOCAL_ACCOUNTS"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION"
}
],
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.MANAGE_LOCAL_ACCOUNTS"
,
"reason"
:
"ceshi"
},
{
"name"
:
"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION"
,
"reason"
:
"ceshi"
}
],
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"com.example.actsosaccountsystemtest.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
\ No newline at end of file
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/app.js
0 → 100755
浏览文件 @
33df8ab1
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/i18n/en-US.json
0 → 100755
浏览文件 @
33df8ab1
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/i18n/zh-CN.json
0 → 100755
浏览文件 @
33df8ab1
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/pages/index/index.css
0 → 100755
浏览文件 @
33df8ab1
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
.titleST
{
font-size
:
32px
;
}
\ No newline at end of file
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/pages/index/index.hml
0 → 100755
浏览文件 @
33df8ab1
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
STActsOsAccountSystemTest
</text>
</div>
account/osaccount/actsosaccountsystemtest/entry/src/main/js/default/pages/index/index.js
0 → 100755
浏览文件 @
33df8ab1
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
file
from
'
@system.file
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
\ No newline at end of file
account/osaccount/actsosaccountsystemtest/entry/src/main/js/resources/base/element/string.json
0 → 100755
浏览文件 @
33df8ab1
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"ActsOsAccountSystemTest"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
account/osaccount/actsosaccountsystemtest/entry/src/main/js/resources/base/media/icon.png
0 → 100755
浏览文件 @
33df8ab1
6.6 KB
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/Activate.test.js
0 → 100755
浏览文件 @
33df8ab1
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ActsOsAccountSystemTest
'
,
function
()
{
/*
* @tc.number : ActsOsAccountActivate_0100
* @tc.name : activateOsAccount callback
* @tc.desc : Verify repeat switch 100 local user
*/
it
(
'
ActsOsAccountActivate_0100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountActivate_0100 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
isOsAccountActived
(
100
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountActived data:
"
+
data
);
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
();
})
})
});
/*
* @tc.number : ActsOsAccountActivate_0200
* @tc.name : activateOsAccount promise
* @tc.desc : Verify repeat switch 100 local user
*/
it
(
'
ActsOsAccountActivate_0200
'
,
0
,
async
function
(
done
)
{
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
();
}
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
isActived
));
expect
(
isActived
).
assertTrue
();
try
{
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
();
}
});
/*
* @tc.number : ActsOsAccountActivate_0300
* @tc.name : activateOsAccount callback
* @tc.desc : Authenticate switch to newly created local user
*/
it
(
'
ActsOsAccountActivate_0300
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountActivate_0300 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
var
osLocalId
;
osAccountManager
.
createOsAccount
(
"
osAccountNameTestActivate
"
,
1
,
(
err
,
osAccountInfo
)
=>
{
console
.
debug
(
"
====>createOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>createOsAccount osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
osLocalId
=
osAccountInfo
.
localId
;
expect
(
err
.
code
).
assertEqual
(
0
);
osAccountManager
.
isOsAccountActived
(
osLocalId
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>localId:
"
+
osLocalId
+
"
isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>localId:
"
+
osLocalId
+
"
isOsAccountActived data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertFalse
();
osAccountManager
.
activateOsAccount
(
osLocalId
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount localId:
"
+
osLocalId
+
"
err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
osAccountManager
.
isOsAccountActived
(
osLocalId
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>localId:
"
+
osLocalId
+
"
isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>localId:
"
+
osLocalId
+
"
isOsAccountActived data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertTrue
();
osAccountManager
.
isOsAccountActived
(
100
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>localId: 100 isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>localId: 100 isOsAccountActived data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertFalse
();
osAccountManager
.
activateOsAccount
(
100
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount localId: 100 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
osAccountManager
.
removeOsAccount
(
osLocalId
,
(
err
)
=>
{
console
.
debug
(
"
====>remove localId:
"
+
osLocalId
+
"
err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
console
.
debug
(
"
====>ActsOsAccountActivate_0300 end====
"
);
done
();
})
})
})
})
})
})
})
});
/*
* @tc.number : ActsOsAccountActivate_0400
* @tc.name : activateOsAccount promise
* @tc.desc : Authenticate switch to newly created local user
*/
it
(
'
ActsOsAccountActivate_0400
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountActivate_0400 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
var
osLocalId
;
var
osAccountInfo
=
await
osAccountManager
.
createOsAccount
(
"
osAccountNameTestActivate
"
,
1
);
console
.
debug
(
"
====>createOsAccount osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
osLocalId
=
osAccountInfo
.
localId
;
var
isActived
=
await
osAccountManager
.
isOsAccountActived
(
osLocalId
);
console
.
debug
(
"
====>localId:
"
+
osLocalId
+
"
isOsAccountActived:
"
+
isActived
);
expect
(
isActived
).
assertFalse
();
await
osAccountManager
.
activateOsAccount
(
osLocalId
);
var
isActivedTwice
=
await
osAccountManager
.
isOsAccountActived
(
osLocalId
);
console
.
debug
(
"
====>after activing localId:
"
+
osLocalId
+
"
isOsAccountActived:
"
+
isActivedTwice
);
expect
(
isActivedTwice
).
assertTrue
();
var
isActiveHandred
=
await
osAccountManager
.
isOsAccountActived
(
100
);
console
.
debug
(
"
====>localId: 100 isOsAccountActived:
"
+
isActiveHandred
);
expect
(
isActiveHandred
).
assertFalse
();
await
osAccountManager
.
activateOsAccount
(
100
);
await
osAccountManager
.
removeOsAccount
(
osLocalId
);
console
.
debug
(
"
====>ActsOsAccountActivate_0400 end====
"
);
done
();
});
/*
* @tc.number : ActsOsAccountActivate_0500
* @tc.name : activateOsAccount callback
* @tc.desc : Authenticate failed to switch to 0 user
*/
it
(
'
ActsOsAccountActivate_0500
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountActivate_0500 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
0
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount to 0 user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_0500 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountActivate_0600
* @tc.name : activateOsAccount promise
* @tc.desc : Authenticate failed to switch to 0 user
*/
it
(
'
ActsOsAccountActivate_0600
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountActivate_0600 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
await
osAccountManager
.
activateOsAccount
(
0
);
}
catch
(
err
){
console
.
debug
(
"
====>activateOsAccount to 0 user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_0600 end====
"
);
done
();
}
});
/*
* @tc.number : ActsOsAccountActivate_0700
* @tc.name : activateOsAccount callback
* @tc.desc : Authenticate failed to switch to -1 user
*/
it
(
'
ActsOsAccountActivate_0700
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountActivate_0700 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
-
1
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount to -1 user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_0700 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountActivate_0800
* @tc.name : activateOsAccount promise
* @tc.desc : Authenticate failed to switch to -1 user
*/
it
(
'
ActsOsAccountActivate_0800
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountActivate_0800 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
await
osAccountManager
.
activateOsAccount
(
-
1
);
}
catch
(
err
){
console
.
debug
(
"
====>activateOsAccount to -1 user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_0800 end====
"
);
done
();
}
});
/*
* @tc.number : ActsOsAccountActivate_0900
* @tc.name : activateOsAccount callback
* @tc.desc : Authenticate failed to switch to "Abc" user
*/
it
(
'
ActsOsAccountActivate_0900
'
,
0
,
async
function
(
done
)
{
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
();
console
.
debug
(
"
====>ActsOsAccountActivate_0900 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountActivate_1000
* @tc.name : activateOsAccount promise
* @tc.desc : Authenticate failed to switch to "Abc" user
*/
it
(
'
ActsOsAccountActivate_1000
'
,
0
,
async
function
(
done
)
{
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
();
}
});
/*
* @tc.number : ActsOsAccountActivate_1100
* @tc.name : activateOsAccount callback
* @tc.desc : Authenticate failed to switch to undefined user
*/
it
(
'
ActsOsAccountActivate_1100
'
,
0
,
async
function
(
done
)
{
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
();
console
.
debug
(
"
====>ActsOsAccountActivate_1100 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountActivate_1200
* @tc.name : activateOsAccount promise
* @tc.desc : Authenticate failed to switch to undefined user
*/
it
(
'
ActsOsAccountActivate_1200
'
,
0
,
async
function
(
done
)
{
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
();
}
});
/*
* @tc.number : ActsOsAccountActivate_1300
* @tc.name : activateOsAccount callback
* @tc.desc : Authenticate failed to switch to non-existent user
*/
it
(
'
ActsOsAccountActivate_1300
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountActivate_1300 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
nonExistentLocalId
=
1000
;
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
activateOsAccount
(
nonExistentLocalId
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount to nonexist user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_1300 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountActivate_1400
* @tc.name : activateOsAccount promise
* @tc.desc : Authenticate failed to switch to non-existent user
*/
it
(
'
ActsOsAccountActivate_1400
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountActivate_1400 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
nonExistentLocalId
=
1000
;
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
await
osAccountManager
.
activateOsAccount
(
nonExistentLocalId
);
}
catch
(
err
){
console
.
debug
(
"
====>activateOsAccount to nonexist user err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_1400 end====
"
);
done
();
}
});
/*
* @tc.number : ActsOsAccountActivate_1500
* @tc.name : activateOsAccount callback
* @tc.desc : Authenticate delete newly created active user
*/
it
(
'
ActsOsAccountActivate_1500
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountActivate_1500 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
var
localId
;
osAccountManager
.
createOsAccount
(
"
osAccountNameTestDelete
"
,
1
,
(
err
,
osAccountInfo
)
=>
{
console
.
debug
(
"
====>createOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>createOsAccount osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
localId
=
osAccountInfo
.
localId
;
expect
(
err
.
code
).
assertEqual
(
0
);
osAccountManager
.
isOsAccountActived
(
localId
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>localId:
"
+
localId
+
"
isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>localId:
"
+
localId
+
"
isOsAccountActived data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertFalse
();
osAccountManager
.
activateOsAccount
(
localId
,
(
err
)
=>
{
console
.
debug
(
"
====>activateOsAccount localId:
"
+
localId
+
"
err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
osAccountManager
.
isOsAccountActived
(
localId
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>localId:
"
+
localId
+
"
isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>localId:
"
+
localId
+
"
isOsAccountActived data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertTrue
();
osAccountManager
.
removeOsAccount
(
localId
,
(
err
)
=>
{
console
.
debug
(
"
====>remove localId:
"
+
localId
+
"
err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
osAccountManager
.
isOsAccountActived
(
100
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>localId: 100 isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>localId: 100 isOsAccountActived data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_1500 end====
"
);
done
();
})
})
})
})
})
})
});
/*
* @tc.number : ActsOsAccountActivate_1600
* @tc.name : activateOsAccount promise
* @tc.desc : Authenticate delete newly created active user
*/
it
(
'
ActsOsAccountActivate_1600
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountActivate_1600 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
var
localId
;
var
osAccountInfo
=
await
osAccountManager
.
createOsAccount
(
"
osAccountNameTestActivate
"
,
1
);
console
.
debug
(
"
====>createOsAccount osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
localId
=
osAccountInfo
.
localId
;
var
isActived
=
await
osAccountManager
.
isOsAccountActived
(
localId
);
console
.
debug
(
"
====>localId:
"
+
localId
+
"
isOsAccountActived:
"
+
isActived
);
expect
(
isActived
).
assertFalse
();
await
osAccountManager
.
activateOsAccount
(
localId
);
var
isActivedTwice
=
await
osAccountManager
.
isOsAccountActived
(
localId
);
console
.
debug
(
"
====>after activing localId:
"
+
localId
+
"
isOsAccountActived:
"
+
isActivedTwice
);
expect
(
isActivedTwice
).
assertTrue
();
await
osAccountManager
.
removeOsAccount
(
localId
);
var
isActiveHandred
=
await
osAccountManager
.
isOsAccountActived
(
100
);
console
.
debug
(
"
====>localId: 100 isOsAccountActived:
"
+
isActiveHandred
);
expect
(
isActiveHandred
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountActivate_1600 end====
"
);
done
();
});
})
\ No newline at end of file
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/List.test.js
0 → 100755
浏览文件 @
33df8ab1
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require
(
'
./Query.test.js
'
)
require
(
'
./Activate.test.js
'
)
require
(
'
./OnOff.test.js
'
)
\ No newline at end of file
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/OnOff.test.js
0 → 100755
浏览文件 @
33df8ab1
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
TIMEOUTHALF
=
500
;
const
TIMEOUT
=
1000
;
describe
(
'
ActsOsAccountSystemTest
'
,
function
()
{
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
while
((
new
Date
()).
getTime
()
-
start
<
delay
)
{
continue
;
}
}
/*
* @tc.number : ActsOsAccountOnOff_0500
* @tc.name : Subscribe and unsubscribing local multi-user
* @tc.desc : Verification cannot cancel activating type not subscribed
*/
it
(
'
ActsOsAccountOnOff_0500
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountOnOff_0500 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
notOnName
=
"
nameNotSubscribeActivatingTest
"
;
console
.
debug
(
"
====>get AccountManager finish====
"
);
function
offCallback
(){
console
.
debug
(
"
====>wrongly enter off callback====
"
);
expect
().
assertFail
();
done
();
}
osAccountManager
.
off
(
"
activating
"
,
notOnName
,
offCallback
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountOnOff_0500 end====
"
);
done
();
},
TIMEOUT
);
});
/*
* @tc.number : ActsOsAccountOnOff_0600
* @tc.name : Subscribe and unsubscribing local multi-user
* @tc.desc : Verification cannot cancel activate type not subscribed
*/
it
(
'
ActsOsAccountOnOff_0600
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountOnOff_0600 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
var
notOnName
=
"
nameNotSubscribeActivateTest
"
;
console
.
debug
(
"
====>get AccountManager finish====
"
);
function
offCallback
(){
console
.
debug
(
"
====>wrongly enter off callback====
"
);
expect
().
assertFail
();
done
();
}
osAccountManager
.
off
(
"
activate
"
,
notOnName
,
offCallback
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountOnOff_0600 end====
"
);
done
();
},
TIMEOUT
);
});
/*
* @tc.number : ActsOsAccountOnOff_1700
* @tc.name : Subscribe and unsubscribing local multi-user
* @tc.desc : Validate unsubscribe with parameter type as empty string
*/
it
(
'
ActsOsAccountOnOff_1700
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountOnOff_1700 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
function
offCallback
(){
console
.
debug
(
"
====>wrongly enter off callback====
"
);
expect
().
assertFail
();
done
();
}
osAccountManager
.
off
(
""
,
"
osAccountOnOffNameN
"
,
offCallback
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountOnOff_1700 end====
"
);
done
();
},
TIMEOUT
);
});
/*
* @tc.number : ActsOsAccountOnOff_1800
* @tc.name : Subscribe and unsubscribing local multi-user
* @tc.desc : Validate unsubscribe with parameter type as other string
*/
it
(
'
ActsOsAccountOnOff_1800
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountOnOff_1800 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
function
offCallback
(){
console
.
debug
(
"
====>wrongly enter off callback====
"
);
expect
().
assertFail
();
done
();
}
osAccountManager
.
off
(
"
Abc
"
,
"
osAccountOnOffNameO
"
,
offCallback
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountOnOff_1800 end====
"
);
done
();
},
TIMEOUT
);
});
/*
* @tc.number : ActsOsAccountOnOff_1900
* @tc.name : Subscribe and unsubscribing local multi-user
* @tc.desc : Validate unsubscribe with parameter type as undefined
*/
it
(
'
ActsOsAccountOnOff_1900
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountOnOff_1900 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
function
offCallback
(){
console
.
debug
(
"
====>wrongly enter off callback====
"
);
expect
().
assertFail
();
done
();
}
osAccountManager
.
off
(
undefined
,
"
osAccountOnOffNameP
"
,
offCallback
);
setTimeout
(()
=>
{
console
.
debug
(
"
====>ActsOsAccountOnOff_1900 end====
"
);
done
();
},
TIMEOUT
);
});
})
\ No newline at end of file
account/osaccount/actsosaccountsystemtest/entry/src/main/js/test/Query.test.js
0 → 100755
浏览文件 @
33df8ab1
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
OSACCOUNTMAXNUMBER
=
999
;
describe
(
'
ActsOsAccountSystemTest
'
,
function
()
{
/*
* @tc.number : ActsOsAccountQuery_0100
* @tc.name : queryOsAccountById callback
* @tc.desc : Authenticate to get local user 100 information and compare
*/
it
(
'
ActsOsAccountQuery_0100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0100 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
queryOsAccountById
(
100
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>queryOsAccountById data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
localId
).
assertEqual
(
100
);
console
.
debug
(
"
====>ActsOsAccountQuery_0100 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountQuery_0200
* @tc.name : queryOsAccountById promise
* @tc.desc : Authenticate to get local user 100 information and compare
*/
it
(
'
ActsOsAccountQuery_0200
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0200 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
var
osAccountInfo
=
await
osAccountManager
.
queryOsAccountById
(
100
);
console
.
debug
(
"
====>queryOsAccountById osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
expect
(
osAccountInfo
.
localId
).
assertEqual
(
100
);
console
.
debug
(
"
====>ActsOsAccountQuery_0200 end====
"
);
done
();
});
/*
* @tc.number : ActsOsAccountQuery_0300
* @tc.name : queryOsAccountById callback
* @tc.desc : Authenticate failed to obtain local user 0 information
*/
it
(
'
ActsOsAccountQuery_0300
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0300 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
queryOsAccountById
(
0
,
(
err
)
=>
{
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountQuery_0300 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountQuery_0400
* @tc.name : queryOsAccountById promise
* @tc.desc : Authenticate failed to obtain local user 0 information
*/
it
(
'
ActsOsAccountQuery_0400
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0400 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
await
osAccountManager
.
queryOsAccountById
(
0
);
}
catch
(
err
){
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountQuery_0400 end====
"
);
done
();
}
});
/*
* @tc.number : ActsOsAccountQuery_0500
* @tc.name : queryOsAccountById callback
* @tc.desc : Authenticate failed to obtain local user -1 information
*/
it
(
'
ActsOsAccountQuery_0500
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0500 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
queryOsAccountById
(
-
1
,
(
err
)
=>
{
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountQuery_0500 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountQuery_0600
* @tc.name : queryOsAccountById promise
* @tc.desc : Authenticate failed to obtain local user 0 information
*/
it
(
'
ActsOsAccountQuery_0600
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0600 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
await
osAccountManager
.
queryOsAccountById
(
-
1
);
}
catch
(
err
){
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountQuery_0600 end====
"
);
done
();
}
});
/*
* @tc.number : ActsOsAccountQuery_0700
* @tc.name : queryOsAccountById callback
* @tc.desc : Authenticate failed to obtain local user "100" information
*/
it
(
'
ActsOsAccountQuery_0700
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0700 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
queryOsAccountById
(
"
100
"
,
(
err
)
=>
{
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountQuery_0700 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountQuery_0800
* @tc.name : queryOsAccountById promise
* @tc.desc : Authenticate failed to obtain local user "100" information
*/
it
(
'
ActsOsAccountQuery_0800
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0800 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
await
osAccountManager
.
queryOsAccountById
(
"
100
"
);
}
catch
(
err
){
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountQuery_0800 end====
"
);
done
();
}
});
/*
* @tc.number : ActsOsAccountQuery_0900
* @tc.name : queryOsAccountById callback
* @tc.desc : Authenticate failed to obtain local user undefined information
*/
it
(
'
ActsOsAccountQuery_0900
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_0900 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
queryOsAccountById
(
undefined
,
(
err
)
=>
{
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountQuery_0900 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountQuery_1000
* @tc.name : queryOsAccountById promise
* @tc.desc : Authenticate failed to obtain local user undefined information
*/
it
(
'
ActsOsAccountQuery_1000
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_1000 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
try
{
await
osAccountManager
.
queryOsAccountById
(
undefined
);
}
catch
(
err
){
console
.
debug
(
"
====>queryOsAccountById err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountQuery_1000 end====
"
);
done
();
}
});
/*
* @tc.number : ActsOsAccountQuery_1100
* @tc.name : queryAllCreatedOsAccounts callback
* @tc.desc : Verify that all local users contain 100 user
*/
it
(
'
ActsOsAccountQuery_1100
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_1100 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
let
dataMap
=
new
Map
();
osAccountManager
.
queryAllCreatedOsAccounts
((
err
,
data
)
=>
{
console
.
debug
(
"
====>queryAllCreatedOsAccounts err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>queryAllCreatedOsAccounts data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
).
assertEqual
(
0
);
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
dataMap
.
set
(
data
[
i
].
localId
,
data
[
i
].
owner
)
}
expect
(
dataMap
.
has
(
100
)).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountQuery_1100 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountQuery_1200
* @tc.name : queryAllCreatedOsAccounts promise
* @tc.desc : Verify that all local users contain 100 user
*/
it
(
'
ActsOsAccountQuery_1200
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_1200 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
let
dataMap
=
new
Map
();
var
osAccountCreated
=
await
osAccountManager
.
queryAllCreatedOsAccounts
();
console
.
debug
(
"
====>queryAllCreatedOsAccounts:
"
+
JSON
.
stringify
(
osAccountCreated
));
for
(
let
i
=
0
,
len
=
osAccountCreated
.
length
;
i
<
len
;
i
++
)
{
dataMap
.
set
(
osAccountCreated
[
i
].
localId
,
osAccountCreated
[
i
].
owner
)
}
expect
(
dataMap
.
has
(
100
)).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountQuery_1200 end====
"
);
done
();
});
/*
* @tc.number : ActsOsAccountQuery_1500
* @tc.name : queryMaxOsAccountNumber callback
* @tc.desc : Query the maximum number of users that can be created on the device
*/
it
(
'
ActsOsAccountQuery_1500
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_1500 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
osAccountManager
.
queryMaxOsAccountNumber
((
err
,
data
)
=>
{
console
.
debug
(
"
====>queryMaxOsAccountNumber err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>queryMaxOsAccountNumber data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertEqual
(
OSACCOUNTMAXNUMBER
);
console
.
debug
(
"
====>ActsOsAccountQuery_1500 end====
"
);
done
();
})
});
/*
* @tc.number : ActsOsAccountQuery_1600
* @tc.name : queryMaxOsAccountNumber callback
* @tc.desc : Query the maximum number of users that can be created on the device
*/
it
(
'
ActsOsAccountQuery_1600
'
,
0
,
async
function
(
done
)
{
console
.
debug
(
"
====>ActsOsAccountQuery_1600 start====
"
);
var
osAccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get AccountManager finish====
"
);
var
maxOsAccount
=
await
osAccountManager
.
queryMaxOsAccountNumber
();
console
.
debug
(
"
====>queryMaxOsAccountNumber:
"
+
maxOsAccount
);
expect
(
maxOsAccount
).
assertEqual
(
OSACCOUNTMAXNUMBER
);
console
.
debug
(
"
====>ActsOsAccountQuery_1600 end====
"
);
done
();
});
/*
* @tc.number : ActsOsAccountIsVerified_0100
* @tc.name : isOsAccountVerified callback
* @tc.desc : create a os account and check whether the initial state of the os account is verified
*/
it
(
'
ActsOsAccountIsVerified_0100
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0100 start====
"
);
var
AccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
osLocalId
;
AccountManager
.
createOsAccount
(
"
OsAccountNameVerfiedA
"
,
1
,
(
err
,
osAccountInfo
)
=>
{
console
.
debug
(
"
====>createOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>createOsAccount data:
"
+
JSON
.
stringify
(
osAccountInfo
));
osLocalId
=
osAccountInfo
.
localId
;
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
osAccountInfo
.
localName
).
assertEqual
(
"
OsAccountNameVerfiedA
"
);
AccountManager
.
isOsAccountVerified
(
osLocalId
,
(
err
,
data
)
=>
{
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountVerified data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertEqual
(
false
);
AccountManager
.
removeOsAccount
(
osLocalId
,
(
err
)
=>
{
console
.
debug
(
"
====>removeOsAccount err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
0
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0100 end====
"
);
done
();
})
})
})
})
/*
* @tc.number : ActsOsAccountIsVerified_0200
* @tc.name : isOsAccountVerified promise
* @tc.desc : create a os account and check whether the initial state of the os account is verified
*/
it
(
'
ActsOsAccountIsVerified_0200
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0200 start====
"
);
var
AccountManager
=
osaccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
data
=
await
AccountManager
.
createOsAccount
(
"
OsAccountNameVerfiedB
"
,
1
);
console
.
debug
(
"
====>createOsAccount data:
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
localName
).
assertEqual
(
"
OsAccountNameVerfiedB
"
);
var
osAccountLocalId
=
data
.
localId
;
try
{
var
data
=
await
AccountManager
.
isOsAccountVerified
(
osAccountLocalId
);
}
catch
(
err
){
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
console
.
debug
(
"
====>isOsAccountVerified data:
"
+
data
);
expect
(
data
).
assertEqual
(
false
);
await
AccountManager
.
removeOsAccount
(
osAccountLocalId
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0200 end====
"
);
done
();
})
})
\ No newline at end of file
account/osaccount/actsosaccountsystemtest/signature/openharmony_sx.p7b
0 → 100755
浏览文件 @
33df8ab1
文件已添加
account/osaccount/actsosaccountthirdpartytest/BUILD.gn
0 → 100755
浏览文件 @
33df8ab1
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsOsAccountThirdPartyTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsOsAccountThirdPartyTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
account/osaccount/actsosaccountthirdpartytest/Test.json
0 → 100755
浏览文件 @
33df8ab1
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"100000"
,
"package"
:
"com.example.actsosaccountthirdpartytest"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsOsAccountThirdPartyTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
account/osaccount/actsosaccountthirdpartytest/entry/src/main/config.json
0 → 100755
浏览文件 @
33df8ab1
{
"app"
:
{
"bundleName"
:
"com.example.actsosaccountthirdpartytest"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.example.actsosaccountthirdpartytest"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"defPermissions"
:
[
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"ohos.permission.MANAGE_LOCAL_ACCOUNTS"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"ohos.permission.DISTRIBUTED_DATASYNC"
}
],
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.MANAGE_LOCAL_ACCOUNTS"
,
"reason"
:
"ceshi"
},
{
"name"
:
"ohos.permission.DISTRIBUTED_DATASYNC"
,
"reason"
:
"ceshi"
}
],
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"com.example.actsosaccountthirdpartytest.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
\ No newline at end of file
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/app.js
0 → 100755
浏览文件 @
33df8ab1
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/i18n/en-US.json
0 → 100755
浏览文件 @
33df8ab1
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/i18n/zh-CN.json
0 → 100755
浏览文件 @
33df8ab1
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.css
0 → 100755
浏览文件 @
33df8ab1
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
.titleST
{
font-size
:
32px
;
}
\ No newline at end of file
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.hml
0 → 100755
浏览文件 @
33df8ab1
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
STActsOsAccountThirdPartyTest
</text>
</div>
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.js
0 → 100755
浏览文件 @
33df8ab1
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
file
from
'
@system.file
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
\ No newline at end of file
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/resources/base/element/string.json
0 → 100755
浏览文件 @
33df8ab1
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"ActsAccountTest"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/resources/base/media/icon.png
0 → 100755
浏览文件 @
33df8ab1
6.6 KB
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/test/List.test.js
0 → 100755
浏览文件 @
33df8ab1
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require
(
'
./OsAccountIs.test.js
'
)
\ No newline at end of file
account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/test/OsAccountIs.test.js
0 → 100755
浏览文件 @
33df8ab1
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
osAccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ActsOsAccountThirdPartyTest
'
,
function
()
{
/*
* @tc.number : ActsOsAccountDeviceId_0100
* @tc.name : getDistributedVirtualDeviceId callback
* @tc.desc : get distributed virtual device ID
*/
it
(
'
ActsOsAccountDeviceId_0100
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountDeviceId_0100 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
getDistributedVirtualDeviceId
((
err
,
deviceId
)
=>
{
console
.
debug
(
"
====>getDistributedVirtualDeviceId err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>getDistributedVirtualDeviceId deviceId:
"
+
deviceId
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
deviceId
).
assertEqual
(
"
0
"
);
console
.
debug
(
"
====>ActsOsAccountDeviceId_0100 end====
"
);
done
();
})
})
/*
* @tc.number : ActsOsAccountDeviceId_0200
* @tc.name : getDistributedVirtualDeviceId promise
* @tc.desc : get distributed virtual device ID
*/
it
(
'
ActsOsAccountDeviceId_0200
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountDeviceId_0200 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
try
{
var
deviceId
=
await
AccountManager
.
getDistributedVirtualDeviceId
();
}
catch
(
err
){
console
.
error
(
"
====>catch getDistributedVirtualDeviceId err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
console
.
debug
(
"
====>getDistributedVirtualDeviceId:
"
+
deviceId
);
expect
(
deviceId
).
assertEqual
(
"
0
"
);
console
.
debug
(
"
====>ActsOsAccountDeviceId_0200 end====
"
);
done
();
})
/*
* @tc.number : ActsOsAccountIsActived_0100
* @tc.name : isOsAccountActived callback
* @tc.desc : Verify that users are not switched and query 100 users as active
*/
it
(
'
ActsOsAccountIsActived_0100
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsActived_0100 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isOsAccountActived
(
100
,
(
err
,
isActived
)
=>
{
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isOsAccountActived isActived:
"
+
isActived
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
isActived
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0100 end
"
);
done
();
})
})
/*
* @tc.number : ActsOsAccountIsActived_0200
* @tc.name : isOsAccountActived promise
* @tc.desc : Verify that users are not switched and query 100 users as active
*/
it
(
'
ActsOsAccountIsActived_0200
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsActived_0200 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
try
{
var
isActived
=
await
AccountManager
.
isOsAccountActived
(
100
);
}
catch
(
err
){
console
.
debug
(
"
====>catch isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
console
.
debug
(
"
====>isOsAccountActived:
"
+
isActived
);
expect
(
isActived
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0200 end
"
);
done
();
})
/*
* @tc.number : ActsOsAccountIsActived_0300
* @tc.name : isOsAccountActived callback
* @tc.desc : Authentication query 0 user active status failed
*/
it
(
'
ActsOsAccountIsActived_0300
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsActived_0300 start
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isOsAccountActived
(
0
,
(
err
)
=>
{
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountIsActived_0300 end
"
);
done
();
})
})
/*
* @tc.number : ActsOsAccountIsActived_0400
* @tc.name : isOsAccountActived promise
* @tc.desc : Authentication query 0 user active status failed
*/
it
(
'
ActsOsAccountIsActived_0400
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>isOsAccountActived_0400 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
try
{
await
AccountManager
.
isOsAccountActived
(
0
);
}
catch
(
err
){
console
.
debug
(
"
====>isOsAccountActived err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
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
){
console
.
debug
(
"
====>ActsOsAccountIsMulty_0100 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isMultiOsAccountEnable
((
err
,
data
)
=>
{
console
.
debug
(
"
====>isMultiOsAccountEnable err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isMultiOsAccountEnable data:
"
+
data
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountIsMulty_0100 end====
"
);
done
();
})
})
/*
* @tc.number : ActsOsAccountIsMulty_0200
* @tc.name : isMultiOsAccountEnable promise
* @tc.desc : Check whether the function of supporting multiple os account is enabled
*/
it
(
'
ActsOsAccountIsMulty_0200
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsMulty_0200 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
try
{
var
data
=
await
AccountManager
.
isMultiOsAccountEnable
();
}
catch
(
err
){
console
.
debug
(
"
====>catch isMultiOsAccountEnable err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
console
.
debug
(
"
====>isMultiOsAccountEnable data:
"
+
JSON
.
stringify
(
data
));
expect
(
data
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountIsMulty_0200 end====
"
);
done
();
})
/*
* @tc.number : ActsOsAccountIsVerified_0300
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query 0 user is unlocked failed
*/
it
(
'
ActsOsAccountIsVerified_0300
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0300 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isOsAccountVerified
(
0
,
(
err
)
=>
{
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0300 end====
"
);
done
();
})
})
/*
* @tc.number : ActsOsAccountIsVerified_0400
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify query 0 user is unlocked failed
*/
it
(
'
ActsOsAccountIsVerified_0400
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0400 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
try
{
await
AccountManager
.
isOsAccountVerified
(
0
);
}
catch
(
err
){
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountIsVerified_0400 end====
"
);
done
();
}
})
/*
* @tc.number : ActsOsAccountIsVerified_0500
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query "100" user is unlocked failed
*/
it
(
'
ActsOsAccountIsVerified_0500
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0500 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isOsAccountVerified
(
"
100
"
,
(
err
)
=>
{
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0500 end====
"
);
done
();
})
})
/*
* @tc.number : ActsOsAccountIsVerified_0600
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify query "100" user is unlocked failed
*/
it
(
'
ActsOsAccountIsVerified_0600
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0600 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
try
{
await
AccountManager
.
isOsAccountVerified
(
"
100
"
);
}
catch
(
err
){
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountIsVerified_0600 end====
"
);
done
();
}
})
/*
* @tc.number : ActsOsAccountIsVerified_0700
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query undefined user is unlocked failed
*/
it
(
'
ActsOsAccountIsVerified_0700
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0700 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isOsAccountVerified
(
undefined
,
(
err
)
=>
{
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0700 end====
"
);
done
();
})
})
/*
* @tc.number : ActsOsAccountIsVerified_0800
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify query undefined user is unlocked failed
*/
it
(
'
ActsOsAccountIsVerified_0800
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0800 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
try
{
await
AccountManager
.
isOsAccountVerified
(
undefined
);
}
catch
(
err
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0800 err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountIsVerified_0800 end====
"
);
done
();
}
})
/*
* @tc.number : ActsOsAccountIsVerified_0900
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query does not exist user unlock failed
*/
it
(
'
ActsOsAccountIsVerified_0900
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_0900 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
osAccountLocalId
=
1000
;
AccountManager
.
isOsAccountVerified
(
osAccountLocalId
,
(
err
)
=>
{
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertEqual
(
true
);
console
.
debug
(
"
====>ActsOsAccountIsVerified_0900 end====
"
);
done
();
})
})
/*
* @tc.number : ActsOsAccountIsVerified_1000
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify query does not exist user unlock failed
*/
it
(
'
ActsOsAccountIsVerified_1000
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsVerified_1000 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
osAccountLocalId
=
1000
;
try
{
await
AccountManager
.
isOsAccountVerified
(
osAccountLocalId
);
}
catch
(
err
){
console
.
debug
(
"
====>isOsAccountVerified err:
"
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
!=
0
).
assertTrue
();
console
.
debug
(
"
====>ActsOsAccountIsVerified_1000 end====
"
);
done
();
}
})
/*
* @tc.number : ActsOsAccountIsTest_0100
* @tc.name : isTestOsAccount callback
* @tc.desc : check whether this OS account is a test OS account
*/
it
(
'
ActsOsAccountIsTest_0100
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsTest_0100 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
AccountManager
.
isTestOsAccount
((
err
,
data
)
=>
{
console
.
debug
(
"
====>isTestOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>isTestOsAccount data:
"
+
JSON
.
stringify
(
data
));
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
).
assertEqual
(
false
);
console
.
debug
(
"
====>ActsOsAccountIsTest_0100 end====
"
);
done
();
})
})
/*
* @tc.number : ActsOsAccountIsTest_0200
* @tc.name : isTestOsAccount promise
* @tc.desc : check whether this OS account is a test OS account
*/
it
(
'
ActsOsAccountIsTest_0200
'
,
0
,
async
function
(
done
){
console
.
debug
(
"
====>ActsOsAccountIsTest_0200 start====
"
);
var
AccountManager
=
osAccount
.
getAccountManager
();
console
.
debug
(
"
====>get os AccountManager finish====
"
);
var
isTest
=
await
AccountManager
.
isTestOsAccount
();
expect
(
isTest
).
assertFalse
();
console
.
debug
(
"
====>ActsOsAccountIsTest_0200 end====
"
);
done
();
})
})
account/osaccount/actsosaccountthirdpartytest/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
33df8ab1
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录