From 911dd4a9c3429cf7f8b5e666dd243e400d03abc0 Mon Sep 17 00:00:00 2001 From: Haytam Zanid <34218324+zHaytam@users.noreply.github.com> Date: Sun, 9 Feb 2020 16:38:59 +0100 Subject: [PATCH] Double quote issue labels in search API (#2084) --- Octokit.Tests/Clients/SearchClientTests.cs | 6 +++--- Octokit.Tests/Models/SearchIssuesRequestTests.cs | 6 +++--- Octokit/Models/Request/SearchIssuesRequest.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Octokit.Tests/Clients/SearchClientTests.cs b/Octokit.Tests/Clients/SearchClientTests.cs index a9800ca3d3..c2ebdabf5a 100644 --- a/Octokit.Tests/Clients/SearchClientTests.cs +++ b/Octokit.Tests/Clients/SearchClientTests.cs @@ -962,7 +962,7 @@ public void TestingTheLabelsQualifier() connection.Received().Get( Arg.Is(u => u.ToString() == "search/issues"), - Arg.Is>(d => d["q"] == "something+label:bug")); + Arg.Is>(d => d["q"] == "something+label:\"bug\"")); } [Fact] @@ -977,7 +977,7 @@ public void TestingTheLabelsQualifier_Multiple() connection.Received().Get( Arg.Is(u => u.ToString() == "search/issues"), - Arg.Is>(d => d["q"] == "something+label:bug+label:feature")); + Arg.Is>(d => d["q"] == "something+label:\"bug\"+label:\"feature\"")); } [Fact] @@ -1560,7 +1560,7 @@ public void TestingTheRepoAndUserAndLabelQualifier() connection.Received().Get( Arg.Is(u => u.ToString() == "search/issues"), Arg.Is>(d => d["q"] == - "something+label:bug+user:alfhenrik+repo:octokit/octokit.net")); + "something+label:\"bug\"+user:alfhenrik+repo:octokit/octokit.net")); } } diff --git a/Octokit.Tests/Models/SearchIssuesRequestTests.cs b/Octokit.Tests/Models/SearchIssuesRequestTests.cs index caafd0ba5c..9227e7a8e0 100644 --- a/Octokit.Tests/Models/SearchIssuesRequestTests.cs +++ b/Octokit.Tests/Models/SearchIssuesRequestTests.cs @@ -114,9 +114,9 @@ public void HandlesLabelsAttributeCorrectly() var request = new SearchIssuesRequest("test"); Assert.DoesNotContain(request.MergedQualifiers(), x => x.Contains("label:")); - request.Labels = new[] { "label1", "label2" }; - Assert.Contains("label:label1", request.MergedQualifiers()); - Assert.Contains("label:label2", request.MergedQualifiers()); + request.Labels = new[] { "label1", "label 2" }; + Assert.Contains("label:\"label1\"", request.MergedQualifiers()); + Assert.Contains("label:\"label 2\"", request.MergedQualifiers()); } [Fact] diff --git a/Octokit/Models/Request/SearchIssuesRequest.cs b/Octokit/Models/Request/SearchIssuesRequest.cs index 2600e27472..5b5508a34a 100644 --- a/Octokit/Models/Request/SearchIssuesRequest.cs +++ b/Octokit/Models/Request/SearchIssuesRequest.cs @@ -328,7 +328,7 @@ public override IReadOnlyList MergedQualifiers() if (Labels != null) { - parameters.AddRange(Labels.Select(label => string.Format(CultureInfo.InvariantCulture, "label:{0}", label))); + parameters.AddRange(Labels.Select(label => string.Format(CultureInfo.InvariantCulture, "label:\"{0}\"", label))); } if (No.HasValue)