diff options
| author | Anthony Lavado <anthony@lavado.ca> | 2020-06-14 22:50:49 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-14 22:50:49 -0400 |
| commit | cf9223b8cb2f1ebccf20cb1dcd99d19b78cf3e61 (patch) | |
| tree | 95ec837fa654622732ba950859190bb3a16b8619 /tests/Jellyfin.Api.Tests/Auth/CustomAuthenticationHandlerTests.cs | |
| parent | e2b2f74b47cc1d281c0819795b83f8d49d1f3b09 (diff) | |
| parent | 524243a9340bfccd2c9ae708be70a5e49f5f53f1 (diff) | |
Merge pull request #3340 from crobibero/api-migration-merge
Merge master into api-migration
Diffstat (limited to 'tests/Jellyfin.Api.Tests/Auth/CustomAuthenticationHandlerTests.cs')
| -rw-r--r-- | tests/Jellyfin.Api.Tests/Auth/CustomAuthenticationHandlerTests.cs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/Jellyfin.Api.Tests/Auth/CustomAuthenticationHandlerTests.cs b/tests/Jellyfin.Api.Tests/Auth/CustomAuthenticationHandlerTests.cs index 437dfa410..362d41b01 100644 --- a/tests/Jellyfin.Api.Tests/Auth/CustomAuthenticationHandlerTests.cs +++ b/tests/Jellyfin.Api.Tests/Auth/CustomAuthenticationHandlerTests.cs @@ -7,6 +7,8 @@ using AutoFixture; using AutoFixture.AutoMoq; using Jellyfin.Api.Auth; using Jellyfin.Api.Constants; +using Jellyfin.Data.Entities; +using Jellyfin.Data.Enums; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Net; using Microsoft.AspNetCore.Authentication; @@ -126,7 +128,7 @@ namespace Jellyfin.Api.Tests.Auth var user = SetupUser(); var authenticateResult = await _sut.AuthenticateAsync(); - Assert.True(authenticateResult.Principal.HasClaim(ClaimTypes.Name, user.Name)); + Assert.True(authenticateResult.Principal.HasClaim(ClaimTypes.Name, user.Username)); } [Theory] @@ -137,7 +139,7 @@ namespace Jellyfin.Api.Tests.Auth var user = SetupUser(isAdmin); var authenticateResult = await _sut.AuthenticateAsync(); - var expectedRole = user.Policy.IsAdministrator ? UserRoles.Administrator : UserRoles.User; + var expectedRole = user.HasPermission(PermissionKind.IsAdministrator) ? UserRoles.Administrator : UserRoles.User; Assert.True(authenticateResult.Principal.HasClaim(ClaimTypes.Role, expectedRole)); } @@ -153,7 +155,7 @@ namespace Jellyfin.Api.Tests.Auth private User SetupUser(bool isAdmin = false) { var user = _fixture.Create<User>(); - user.Policy.IsAdministrator = isAdmin; + user.SetPermission(PermissionKind.IsAdministrator, isAdmin); _jellyfinAuthServiceMock.Setup( a => a.Authenticate( |
