breaking change - HtmlUrl does not acknowledge custom Accepts. use the proper API

This commit is contained in:
Brendan Forster
2014-09-29 20:32:35 +10:00
parent 2584887235
commit 36b9397484
3 changed files with 11 additions and 11 deletions
@@ -551,12 +551,12 @@ public class RepositoriesClientTests
Credentials = Helper.Credentials
};
// TODO: Change this to request github/Octokit.net once we make this OSS.
var readme = await github.Repository.GetReadme("haacked", "seegit");
var readme = await github.Repository.GetReadme("octokit", "octokit.net");
Assert.Equal("README.md", readme.Name);
string readMeHtml = await readme.GetHtmlContent();
Assert.Contains(@"<div id=""readme""", readMeHtml);
Assert.Contains("<p><strong>WARNING: This is some haacky code.", readMeHtml);
Assert.True(readMeHtml.StartsWith("<div class="));
Assert.Contains(@"data-path=""README.md"" id=""file""", readMeHtml);
Assert.Contains("Octokit - GitHub API Client Library for .NET", readMeHtml);
}
[IntegrationTest]
@@ -567,10 +567,10 @@ public class RepositoriesClientTests
Credentials = Helper.Credentials
};
// TODO: Change this to request github/Octokit.net once we make this OSS.
var readmeHtml = await github.Repository.GetReadmeHtml("haacked", "seegit");
Assert.True(readmeHtml.StartsWith("<div "));
Assert.Contains("<p><strong>WARNING: This is some haacky code.", readmeHtml);
var readmeHtml = await github.Repository.GetReadmeHtml("octokit", "octokit.net");
Assert.True(readmeHtml.StartsWith("<div class="));
Assert.Contains(@"data-path=""README.md"" id=""readme""", readmeHtml);
Assert.Contains("Octokit - GitHub API Client Library for .NET", readmeHtml);
}
}
@@ -347,11 +347,11 @@ namespace Octokit.Tests.Clients
Assert.Equal("README.md", readme.Name);
connection.Received().Get<ReadmeResponse>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/readme"),
null);
connection.DidNotReceive().GetHtml(Arg.Is<Uri>(u => u.ToString() == "https://github.example.com/readme"),
connection.DidNotReceive().GetHtml(Arg.Is<Uri>(u => u.ToString() == "https://github.example.com/readme.md"),
null);
var htmlReadme = await readme.GetHtmlContent();
Assert.Equal("<html>README</html>", htmlReadme);
connection.Received().GetHtml(Arg.Is<Uri>(u => u.ToString() == "https://github.example.com/readme"), null);
connection.Received().GetHtml(Arg.Is<Uri>(u => u.ToString() == "https://github.example.com/readme.md"), null);
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ namespace Octokit
var contentAsBytes = Convert.FromBase64String(response.Content);
Content = Encoding.UTF8.GetString(contentAsBytes, 0, contentAsBytes.Length);
}
htmlContent = new Lazy<Task<string>>(async () => await client.GetHtml(HtmlUrl).ConfigureAwait(false));
htmlContent = new Lazy<Task<string>>(async () => await client.GetHtml(Url).ConfigureAwait(false));
}
public string Content { get; private set; }