mirror of https://github.com/abpframework/abp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.7 KiB
61 lines
2.7 KiB
using Microsoft.AspNetCore.Identity;
|
|
using Shouldly;
|
|
using System.Threading.Tasks;
|
|
using Volo.Abp.EventBus.Distributed;
|
|
using Volo.Abp.Guids;
|
|
using Volo.Abp.PermissionManagement;
|
|
using Volo.Abp.Uow;
|
|
using Xunit;
|
|
|
|
namespace Volo.Abp.Identity
|
|
{
|
|
//TODO: This code can not be here!
|
|
//https://github.com/abpframework/abp/commit/847f526041145b62376b760776829d5ce257da1c
|
|
// public class RoleChangingEvents_Test : AbpIdentityDomainTestBase
|
|
// {
|
|
// protected readonly IIdentityRoleRepository RoleRepository;
|
|
// protected readonly IPermissionGrantRepository PermissionGrantRepository;
|
|
// protected readonly IdentityRoleManager RoleManager;
|
|
// protected readonly ILookupNormalizer LookupNormalizer;
|
|
// protected readonly IGuidGenerator GuidGenerator;
|
|
// protected readonly IUnitOfWorkManager UowManager;
|
|
//
|
|
// public RoleChangingEvents_Test()
|
|
// {
|
|
// RoleRepository = GetRequiredService<IIdentityRoleRepository>(); ;
|
|
// PermissionGrantRepository = GetRequiredService<IPermissionGrantRepository>(); ;
|
|
// RoleManager = GetRequiredService<IdentityRoleManager>(); ;
|
|
// LookupNormalizer = GetRequiredService<ILookupNormalizer>(); ;
|
|
// GuidGenerator = GetRequiredService<IGuidGenerator>();
|
|
// UowManager = GetRequiredService<IUnitOfWorkManager>();
|
|
// }
|
|
//
|
|
// [Fact(Skip = "https://github.com/abpframework/abp/actions/runs/454248191")]
|
|
// public async Task Role_Update_Event_Test()
|
|
// {
|
|
// var role = await RoleRepository
|
|
// .FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator"))
|
|
// ;
|
|
//
|
|
// var permissionGrantsInRole = await PermissionGrantRepository.GetListAsync("R", role.Name);
|
|
// permissionGrantsInRole.ShouldNotBeNull();
|
|
// permissionGrantsInRole.Count.ShouldBeGreaterThan(0);
|
|
// var count = permissionGrantsInRole.Count;
|
|
//
|
|
// using (var uow = UowManager.Begin())
|
|
// {
|
|
// var identityResult = await RoleManager.SetRoleNameAsync(role, "TestModerator");
|
|
// identityResult.Succeeded.ShouldBeTrue();
|
|
// var xx = await RoleRepository.UpdateAsync(role);
|
|
// await uow.CompleteAsync();
|
|
// }
|
|
//
|
|
// role = await RoleRepository.GetAsync(role.Id);
|
|
// role.Name.ShouldBe("TestModerator");
|
|
//
|
|
// permissionGrantsInRole = await PermissionGrantRepository.GetListAsync("R", role.Name);
|
|
// permissionGrantsInRole.Count.ShouldBe(count);
|
|
// }
|
|
// }
|
|
}
|