mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-28 08:58:37 +00:00
Move error handling to Connection
The adapter shouldn't be responsible for translating errors into the proper exception.
This commit is contained in:
@@ -74,23 +74,6 @@ namespace Octokit.Tests.Http
|
||||
Assert.Equal("{}", response.Body);
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ThrowsExceptionWhenForbidden()
|
||||
{
|
||||
var responseMessage = new HttpResponseMessage {
|
||||
StatusCode = HttpStatusCode.Forbidden,
|
||||
Headers =
|
||||
{
|
||||
{"peanut", "butter"},
|
||||
}
|
||||
};
|
||||
var tester = new HttpClientAdapterTester();
|
||||
|
||||
var exception = await AssertEx.Throws<AuthenticationException>(async () =>
|
||||
await tester.BuildResponseTester<string>(responseMessage));
|
||||
Assert.Equal(HttpStatusCode.Forbidden, exception.StatusCode);
|
||||
}
|
||||
}
|
||||
|
||||
sealed class HttpClientAdapterTester : HttpClientAdapter
|
||||
|
||||
Reference in New Issue
Block a user