diff options
| author | Bond-009 <bond.009@outlook.com> | 2021-04-08 23:33:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-08 23:33:18 +0200 |
| commit | a19a97ca4225a57c3cce71cdd0b9dd4a08f65993 (patch) | |
| tree | d27483c95ecfcdb4137354e6d0b77072120120f3 /tests/Jellyfin.Server.Integration.Tests/Controllers/ActivityLogControllerTests.cs | |
| parent | 9bf3ec4ae2422f6e1331c6e786109be973385547 (diff) | |
| parent | 45a16c19a76d8fac36d3acf864f8030fb30d4e1c (diff) | |
Merge pull request #5721 from Bond-009/authenticatedtests
Add code to test authenticated endpoints
Diffstat (limited to 'tests/Jellyfin.Server.Integration.Tests/Controllers/ActivityLogControllerTests.cs')
| -rw-r--r-- | tests/Jellyfin.Server.Integration.Tests/Controllers/ActivityLogControllerTests.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/ActivityLogControllerTests.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/ActivityLogControllerTests.cs new file mode 100644 index 000000000..4657ee6e2 --- /dev/null +++ b/tests/Jellyfin.Server.Integration.Tests/Controllers/ActivityLogControllerTests.cs @@ -0,0 +1,30 @@ +using System.Net; +using System.Net.Mime; +using System.Threading.Tasks; +using Xunit; + +namespace Jellyfin.Server.Integration.Tests.Controllers +{ + public sealed class ActivityLogControllerTests : IClassFixture<JellyfinApplicationFactory> + { + private readonly JellyfinApplicationFactory _factory; + private string? _accessToken; + + public ActivityLogControllerTests(JellyfinApplicationFactory factory) + { + _factory = factory; + } + + [Fact] + public async Task ActivityLog_GetEntries_Ok() + { + var client = _factory.CreateClient(); + client.DefaultRequestHeaders.AddAuthHeader(_accessToken ??= await AuthHelper.CompleteStartupAsync(client).ConfigureAwait(false)); + + var response = await client.GetAsync("System/ActivityLog/Entries").ConfigureAwait(false); + + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.Equal(MediaTypeNames.Application.Json, response.Content.Headers.ContentType?.MediaType); + } + } +} |
