mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-03 22:38:30 +01:00
Merge pull request #5255 from cvium/fix_renameuser
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Emby.Server.Implementations\Emby.Server.Implementations.csproj" />
|
||||
<ProjectReference Include="..\..\Jellyfin.Server.Implementations\Jellyfin.Server.Implementations.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using Jellyfin.Server.Implementations.Users;
|
||||
using Xunit;
|
||||
|
||||
namespace Jellyfin.Server.Implementations.Tests.Users
|
||||
{
|
||||
public class UserManagerTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("this_is_valid")]
|
||||
[InlineData("this is also valid")]
|
||||
[InlineData("0@_-' .")]
|
||||
public void ThrowIfInvalidUsername_WhenValidUsername_DoesNotThrowArgumentException(string username)
|
||||
{
|
||||
var ex = Record.Exception(() => UserManager.ThrowIfInvalidUsername(username));
|
||||
Assert.Null(ex);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(" ")]
|
||||
[InlineData("")]
|
||||
[InlineData("special characters like & $ ? are not allowed")]
|
||||
public void ThrowIfInvalidUsername_WhenInvalidUsername_ThrowsArgumentException(string username)
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => UserManager.ThrowIfInvalidUsername(username));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user