提交 252b8618 编写于 作者: J jinhaihw

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

Signed-off-by: Njinhaihw <jinhai2@huawei.com>
Change-Id: I16f380fe6a58ebd75595e3c3934c0b7004e29311
上级 78ff0d0e
......@@ -142,4 +142,73 @@ describe('AccessTokenTest', function () {
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.
先完成此消息的编辑!
想要评论请 注册