aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Integration.Tests/EncodedQueryStringTest.cs
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2021-06-07 23:07:59 +0200
committerGitHub <noreply@github.com>2021-06-07 23:07:59 +0200
commit93387ba235fc86861d4cf24c582f49fb33bb0787 (patch)
tree5917003d31cf18a4c31a18fd04ec8a9a6f30e749 /tests/Jellyfin.Server.Integration.Tests/EncodedQueryStringTest.cs
parent19a18899065aa2d50b0a989911a5f58a368b3b95 (diff)
parent147612f59bb5870f04197087e3d5fcd954061471 (diff)
Merge pull request #5990 from BaronGreenback/UrlDecoding
Diffstat (limited to 'tests/Jellyfin.Server.Integration.Tests/EncodedQueryStringTest.cs')
-rw-r--r--tests/Jellyfin.Server.Integration.Tests/EncodedQueryStringTest.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Integration.Tests/EncodedQueryStringTest.cs b/tests/Jellyfin.Server.Integration.Tests/EncodedQueryStringTest.cs
new file mode 100644
index 000000000..29d3fe33d
--- /dev/null
+++ b/tests/Jellyfin.Server.Integration.Tests/EncodedQueryStringTest.cs
@@ -0,0 +1,33 @@
+using System.Net;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Jellyfin.Server.Integration.Tests
+{
+ /// <summary>
+ /// Defines the test for encoded querystrings in the url.
+ /// </summary>
+ public class EncodedQueryStringTest : IClassFixture<JellyfinApplicationFactory>
+ {
+ private readonly JellyfinApplicationFactory _factory;
+
+ public EncodedQueryStringTest(JellyfinApplicationFactory factory)
+ {
+ _factory = factory;
+ }
+
+ [Theory]
+ [InlineData("a=1&b=2&c=3", "a=1&b=2&c=3")] // won't be processed as there is more than 1.
+ [InlineData("a=1", "a=1")] // won't be processed as it has a value
+ [InlineData("a%3D1%26b%3D2%26c%3D3", "a=1&b=2&c=3")] // will be processed.
+ public async Task Ensure_Decoding_Of_Urls_Is_Working(string sourceUrl, string unencodedUrl)
+ {
+ var client = _factory.CreateClient();
+
+ var response = await client.GetAsync("Encoder/UrlDecode?" + sourceUrl).ConfigureAwait(false);
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ string reply = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Assert.Equal(unencodedUrl, reply);
+ }
+ }
+}