未验证 提交 0fa6afdc 编写于 作者: O openharmony_ci 提交者: Gitee

!4249 【security】【master】增加 access_token 测试套verifyAccessTokenSync接口测试用例

Merge pull request !4249 from 金海/access_token_fxb0711_master
...@@ -142,4 +142,73 @@ describe('AccessTokenTest', function () { ...@@ -142,4 +142,73 @@ describe('AccessTokenTest', function () {
done(); done();
}) })
/**
* @tc.number Test_verifyAccessTokenSync_0000
* @tc.name Test_verifyAccessTokenSync_000.
* @tc.desc Test verifyAccessTokenSync, After the installation, user_grant permission is not granted by default.
*/
it('Test_verifyAccessTokenSync_000', 0, function(){
console.info("Test_verifyAccessTokenSync_000 start");
var atManager = abilityAccessCtrl.createAtManager();
var result = atManager.verifyAccessTokenSync(tokenID, permissionNameUser);
console.info("Test_verifyAccessTokenSync_000 tokenID" + tokenID + "-" + result)
expect(result).assertEqual(GrantStatus.PERMISSION_DENIED);
})
/**
* @tc.number Test_verifyAccessTokenSync_0100
* @tc.name Test_verifyAccessTokenSync_001.
* @tc.desc Test verifyAccessTokenSync, After the installation, system_grant permission is granted by default.
*/
it('Test_verifyAccessTokenSync_001', 0, function(){
console.info("Test_verifyAccessTokenSync_001 start");
var atManager = abilityAccessCtrl.createAtManager();
var result = atManager.verifyAccessTokenSync(tokenID, permissionNameSystem);
console.info("Test_verifyAccessTokenSync_001 tokenID" + tokenID + "-" + result)
expect(result).assertEqual(GrantStatus.PERMISSION_GRANTED);
})
/**
* @tc.number Test_verifyAccessTokenSync_0200
* @tc.name Test_verifyAccessTokenSync_002.
* @tc.desc Test verifyAccessTokenSync, invalid TokenID(0).
*/
it('Test_verifyAccessTokenSync_002', 0, function(){
console.info("Test_verifyAccessTokenSync_002 start");
var atManager = abilityAccessCtrl.createAtManager();
var result = atManager.verifyAccessTokenSync(0, permissionNameUser);
console.info("Test_verifyAccessTokenSync_002 tokenID" + tokenID + "-" + result)
expect(result).assertEqual(GrantStatus.PERMISSION_DENIED);
})
/**
* @tc.number Test_verifyAccessTokenSync_0300
* @tc.name Test_verifyAccessTokenSync_003.
* @tc.desc Test verifyAccessTokenSync, invalid permission(empty).
*/
it('Test_verifyAccessTokenSync_003', 0, function(){
console.info("Test_verifyAccessTokenSync_003 start");
var atManager = abilityAccessCtrl.createAtManager();
var result = atManager.verifyAccessTokenSync(tokenID, "");
console.info("Test_verifyAccessTokenSync_003 tokenID" + tokenID + "-" + result)
expect(result).assertEqual(GrantStatus.PERMISSION_DENIED);
})
/**
* @tc.number Test_verifyAccessTokenSync_0400
* @tc.name Test_verifyAccessTokenSync_004.
* @tc.desc Test verifyAccessTokenSync, invalid permission(length exceeds 256).
*/
it('Test_verifyAccessTokenSync_004', 0, function(){
console.info("Test_verifyAccessTokenSync_004 start");
var atManager = abilityAccessCtrl.createAtManager();
var permissionName = "ohos.permission.testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest"
+ "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest"
+ "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest";
var result = atManager.verifyAccessTokenSync(tokenID, permissionName);
console.info("Test_verifyAccessTokenSync_004 tokenID" + tokenID + "-" + result)
expect(result).assertEqual(GrantStatus.PERMISSION_DENIED);
})
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册