aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2023-10-11 18:32:57 +0200
committerBond_009 <bond.009@outlook.com>2023-10-11 18:32:57 +0200
commitd7748cfa0476280cce9dba34b4512cc58760c8bb (patch)
tree368389260833164e812cbb192989023c017cd755 /tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs
parent26571a8c51b9670f198e58175463e1d3db5441ee (diff)
Multiple Stream changes
* Remove useless MemoryStream in DlnaHttpClient * Use HttpContent.ReadFromJsonAsync extension * Call ConfigureAwait for IAsyncDisposable * Use HttpContent.CopyToAsync where possible
Diffstat (limited to 'tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs')
-rw-r--r--tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs11
1 files changed, 3 insertions, 8 deletions
diff --git a/tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs b/tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs
index 5ddbd30d1..4e8aec9f1 100644
--- a/tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs
+++ b/tests/Jellyfin.Server.Integration.Tests/AuthHelper.cs
@@ -40,9 +40,7 @@ namespace Jellyfin.Server.Integration.Tests
using var authResponse = await client.SendAsync(httpRequest);
authResponse.EnsureSuccessStatusCode();
- var auth = await JsonSerializer.DeserializeAsync<AuthenticationResultDto>(
- await authResponse.Content.ReadAsStreamAsync(),
- jsonOptions);
+ var auth = await authResponse.Content.ReadFromJsonAsync<AuthenticationResultDto>(jsonOptions);
return auth!.AccessToken;
}
@@ -51,8 +49,7 @@ namespace Jellyfin.Server.Integration.Tests
{
using var response = await client.GetAsync("Users/Me");
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
- var userDto = await JsonSerializer.DeserializeAsync<UserDto>(
- await response.Content.ReadAsStreamAsync(), JsonDefaults.Options);
+ var userDto = await response.Content.ReadFromJsonAsync<UserDto>(JsonDefaults.Options);
Assert.NotNull(userDto);
return userDto;
}
@@ -67,9 +64,7 @@ namespace Jellyfin.Server.Integration.Tests
var response = await client.GetAsync($"Users/{userId}/Items/Root");
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
- var rootDto = await JsonSerializer.DeserializeAsync<BaseItemDto>(
- await response.Content.ReadAsStreamAsync(),
- JsonDefaults.Options);
+ var rootDto = await response.Content.ReadFromJsonAsync<BaseItemDto>(JsonDefaults.Options);
Assert.NotNull(rootDto);
return rootDto;
}