Skip to content

Commit

Permalink
Fix Functional Test failure for ODataFeeds.V2FeedExtendedTests.FindPa…
Browse files Browse the repository at this point in the history
…ckagesByIdTest #3947 (#3948)
  • Loading branch information
xavierdecoster committed May 18, 2017
1 parent 6b4af56 commit ea1fe6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,20 @@ private static Uri BuildIdLink(string id, string version, HttpRequestMessage req
var packageIdentityQuery = $"(Id='{id}',Version='{version}')";
var localPath = request.RequestUri.LocalPath
// Remove closing brackets from Packages collection
.Replace("/GetUpdates", "/Packages")
.Replace("/FindPackagesById", "/Packages")
.Replace("/Search", "/Packages")
.Replace("/Packages()", "/Packages")
// Remove package identity query
.Replace(packageIdentityQuery, string.Empty);

// Ensure any OData queries remaining are stripped off
var queryStartIndex = localPath.IndexOf('(');
if (queryStartIndex != -1)
{
localPath = localPath.Substring(0, queryStartIndex);
}

return new Uri($"{request.RequestUri.Scheme}://{request.RequestUri.Host}{localPath}{packageIdentityQuery}");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public void SetsAtomEntryMetadataAnnotation()
[InlineData("https://localhost/api/v2/Packages")]
[InlineData("https://localhost/api/v2/Packages()")]
[InlineData("https://localhost/api/v2/Packages(Id='SomePackageId',Version='1.0.0')")]
[InlineData("https://localhost/api/v2/FindPackagesById()?id='SomePackageId'")]
[InlineData("https://localhost/api/v2/FindPackagesById(Id='SomePackageId')")]
[InlineData("https://localhost/api/v2/Search()?searchTerm='SomePackageId'")]
[InlineData("https://localhost/api/v2/GetUpdates()?packageIds=='SomePackageId'")]
public void NormalizesNavigationLinksWhenSet(string requestUri)
{
// Arrange
Expand Down

0 comments on commit ea1fe6c

Please sign in to comment.