Dear,
when i try to run Unit test, show error "required permission not granted". my AppService is:
[AbpAuthorize(AppPermissions.Pages_CreditConsumptions_Create)] public async Task CreateCreditConsumption(CreateCreditConsumptionInput input) { //var creditConsumption = input.MapTo<CreditConsumption>(); var creditConsumption = new CreditConsumption }
So how to declare permission in AppService_test , when run unit test, it can pass?
Thanks in Advance
2 Answer(s)
-
0
Hi,
TenantRoleAndUserBuilder grants all permissions to tenant admin user and HostRoleAndUserCreator class does same for host admin.
If you use default tenant admin or host admin user in your tests, this should not be a problem. If you are going to use a different use, you should grant access to that user just like we do in those two classess.
Dont forget to do it only in test module.
-
0
Hi,
Thanks.
Thanks