Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double quote issue labels in search API #2084

Merged
merged 2 commits into from
Feb 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Octokit.Tests/Clients/SearchClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ public void TestingTheLabelsQualifier()

connection.Received().Get<SearchIssuesResult>(
Arg.Is<Uri>(u => u.ToString() == "search/issues"),
Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+label:bug"));
Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+label:\"bug\""));
}

[Fact]
Expand All @@ -977,7 +977,7 @@ public void TestingTheLabelsQualifier_Multiple()

connection.Received().Get<SearchIssuesResult>(
Arg.Is<Uri>(u => u.ToString() == "search/issues"),
Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+label:bug+label:feature"));
Arg.Is<Dictionary<string, string>>(d => d["q"] == "something+label:\"bug\"+label:\"feature\""));
}

[Fact]
Expand Down Expand Up @@ -1560,7 +1560,7 @@ public void TestingTheRepoAndUserAndLabelQualifier()
connection.Received().Get<SearchIssuesResult>(
Arg.Is<Uri>(u => u.ToString() == "search/issues"),
Arg.Is<Dictionary<string, string>>(d => d["q"] ==
"something+label:bug+user:alfhenrik+repo:octokit/octokit.net"));
"something+label:\"bug\"+user:alfhenrik+repo:octokit/octokit.net"));
}
}

Expand Down
6 changes: 3 additions & 3 deletions Octokit.Tests/Models/SearchIssuesRequestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Request/SearchIssuesRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public override IReadOnlyList<string> 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)
Expand Down