Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Unit test fail due to "required permission not granted" #1856


User avatar
0
jibbar created

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)
  • User Avatar
    0
    ismcagdas created
    Support Team

    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.

  • User Avatar
    0
    jibbar created

    Hi,

    Thanks.

    Thanks