mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-10-06 13:55:39 -04:00
test(protocols): remove unshipped playlist artwork cases
CI / build-and-test (push) Canceled after 0s
CI / release-critical-tests (push) Canceled after 0s
CI / csharp-format (push) Canceled after 0s
CI / webui (push) Canceled after 0s
CI / release-manifest (push) Canceled after 0s
CI / apple-contracts (push) Canceled after 0s
CI / compose-contracts (push) Canceled after 0s
CI / build-and-test (push) Canceled after 0s
CI / release-critical-tests (push) Canceled after 0s
CI / csharp-format (push) Canceled after 0s
CI / webui (push) Canceled after 0s
CI / release-manifest (push) Canceled after 0s
CI / apple-contracts (push) Canceled after 0s
CI / compose-contracts (push) Canceled after 0s
This commit is contained in:
1 file changed
-75
@@ -816,38 +816,6 @@ public sealed class ProtocolRouteFixtureTests
|
||||
gateway.VerifyAll();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task JellyfinSpotifyPlaylistImage_UsesAccountScopedTypedArtwork()
|
||||
{
|
||||
var artworkBytes = new byte[] { 0xFF, 0xD8, 0xFF, 0xD9 };
|
||||
var gateway = new Mock<IProtocolProviderGateway>(MockBehavior.Strict);
|
||||
gateway.Setup(service => service.ResolvePlaylistArtworkAsync(
|
||||
It.Is<ProtocolExecutionContext>(context => context.Protocol == ProtocolKind.Jellyfin),
|
||||
"spotify",
|
||||
"playlist-1",
|
||||
10 * 1024 * 1024))
|
||||
.ReturnsAsync(new ProviderPlaylistArtwork(artworkBytes, "image/jpeg"));
|
||||
using var factory = new ProtocolFactory(
|
||||
"Jellyfin",
|
||||
request => request.RequestUri!.AbsolutePath == "/Users/Me"
|
||||
? Json(StatusCodes.Status200OK, """{"Id":"verified-user"}""")
|
||||
: throw new InvalidOperationException($"Unexpected upstream request: {request.RequestUri}"),
|
||||
services =>
|
||||
{
|
||||
services.RemoveAll<IProtocolProviderGateway>();
|
||||
services.AddSingleton(gateway.Object);
|
||||
});
|
||||
using var client = factory.CreateClient();
|
||||
|
||||
using var response = await client.GetAsync(
|
||||
"/Items/ext-spotify-playlist-playlist-1/Images/Primary?api_key=fixture-key");
|
||||
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
Assert.Equal("image/jpeg", response.Content.Headers.ContentType?.MediaType);
|
||||
Assert.Equal(artworkBytes, await response.Content.ReadAsByteArrayAsync());
|
||||
gateway.VerifyAll();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task JellyfinSynthesizedLongImageRoute_HonorsSizeAndFormat()
|
||||
{
|
||||
@@ -2211,49 +2179,6 @@ public sealed class ProtocolRouteFixtureTests
|
||||
metadata.VerifyNoOtherCalls();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SubsonicSpotifyPlaylistCover_UsesAccountScopedTypedArtwork()
|
||||
{
|
||||
var artworkBytes = new byte[] { 0xFF, 0xD8, 0xFF, 0xD9 };
|
||||
var gateway = new Mock<IProtocolProviderGateway>(MockBehavior.Strict);
|
||||
gateway.Setup(service => service.GetPlaylistAsync(
|
||||
It.Is<ProtocolExecutionContext>(context => context.Protocol == ProtocolKind.Subsonic),
|
||||
"spotify",
|
||||
"playlist-1"))
|
||||
.ReturnsAsync(new ExternalPlaylist
|
||||
{
|
||||
Id = "ext-spotify-playlist-playlist-1",
|
||||
Provider = "spotify",
|
||||
ExternalId = "playlist-1",
|
||||
Name = "Road mix"
|
||||
});
|
||||
gateway.Setup(service => service.ResolvePlaylistArtworkAsync(
|
||||
It.Is<ProtocolExecutionContext>(context => context.Protocol == ProtocolKind.Subsonic),
|
||||
"spotify",
|
||||
"playlist-1",
|
||||
10 * 1024 * 1024))
|
||||
.ReturnsAsync(new ProviderPlaylistArtwork(artworkBytes, "image/jpeg"));
|
||||
using var factory = new ProtocolFactory(
|
||||
"Subsonic",
|
||||
request => request.RequestUri!.AbsolutePath == "/rest/ping.view"
|
||||
? Json(StatusCodes.Status200OK, """{"subsonic-response":{"status":"ok","version":"1.16.1"}}""")
|
||||
: throw new InvalidOperationException($"Unexpected upstream request: {request.RequestUri}"),
|
||||
services =>
|
||||
{
|
||||
services.RemoveAll<IProtocolProviderGateway>();
|
||||
services.AddSingleton(gateway.Object);
|
||||
});
|
||||
using var client = factory.CreateClient();
|
||||
|
||||
using var response = await client.GetAsync(
|
||||
"/rest/getCoverArt.view?u=fixture&p=secret&v=1.16.1&c=fixture&id=ext-spotify-playlist-playlist-1");
|
||||
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
Assert.Equal("image/jpeg", response.Content.Headers.ContentType?.MediaType);
|
||||
Assert.Equal(artworkBytes, await response.Content.ReadAsByteArrayAsync());
|
||||
gateway.VerifyAll();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SubsonicAuthBoundary_RejectsBeforeBackendActionsAndPreservesVerificationResponse()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user