Skip to content

Commit

Permalink
Double quote issue labels in search API (#2084)
Browse files Browse the repository at this point in the history
  • Loading branch information
zHaytam authored Feb 9, 2020
1 parent 9b136b1 commit 911dd4a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
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

0 comments on commit 911dd4a

Please sign in to comment.