diff options
| author | Bond-009 <bond.009@outlook.com> | 2023-10-08 14:07:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-08 14:07:22 +0200 |
| commit | cf806ddcaade30a2a656b4974f12b9453c8d21e7 (patch) | |
| tree | f272f3f1bd7fd7e68cdf4d0d54201a2a868f73c6 /tests | |
| parent | 7fc804e4b85a851a6b78c08602b1e1f3fb35b93f (diff) | |
| parent | b87765bacec36aba3ee37ebc034458f36c637ffe (diff) | |
Merge pull request #10336 from Bond-009/authorization
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs b/tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs index 3dc62afaf..5ddbd30d1 100644 --- a/tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs +++ b/tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs @@ -15,8 +15,8 @@ namespace Jellyfin.Server.Integration.Tests { public static class AuthHelper { - public const string AuthHeaderName = "X-Emby-Authorization"; - public const string DummyAuthHeader = "MediaBrowser Client=\"Jellyfin.Server Integration Tests\", DeviceId=\"69420\", Device=\"Apple II\", Version=\"10.8.0\""; + public const string AuthHeaderName = "Authorization"; + public const string DummyAuthHeader = "MediaBrowser Client=\"Jellyfin.Server%20Integration%20Tests\", DeviceId=\"69420\", Device=\"Apple%20II\", Version=\"10.8.0\""; public static async Task<string> CompleteStartupAsync(HttpClient client) { @@ -27,16 +27,19 @@ namespace Jellyfin.Server.Integration.Tests using var completeResponse = await client.PostAsync("/Startup/Complete", new ByteArrayContent(Array.Empty<byte>())); Assert.Equal(HttpStatusCode.NoContent, completeResponse.StatusCode); - using var content = JsonContent.Create( + using var httpRequest = new HttpRequestMessage(HttpMethod.Post, "/Users/AuthenticateByName"); + httpRequest.Headers.TryAddWithoutValidation(AuthHeaderName, DummyAuthHeader); + httpRequest.Content = JsonContent.Create( new AuthenticateUserByName() { Username = user!.Name, Pw = user.Password, }, options: jsonOptions); - content.Headers.Add("X-Emby-Authorization", DummyAuthHeader); - using var authResponse = await client.PostAsync("/Users/AuthenticateByName", content); + using var authResponse = await client.SendAsync(httpRequest); + authResponse.EnsureSuccessStatusCode(); + var auth = await JsonSerializer.DeserializeAsync<AuthenticationResultDto>( await authResponse.Content.ReadAsStreamAsync(), jsonOptions); |
