mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 03:01:31 +00:00
Fix up ApiExtensions
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Octokit.Tests.Http
|
||||
httpClient,
|
||||
Substitute.For<IJsonSerializer>());
|
||||
|
||||
await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative));
|
||||
await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative));
|
||||
|
||||
httpClient.Received(1).Send<string>(Arg.Is<IRequest>(req =>
|
||||
req.BaseAddress == ExampleUri &&
|
||||
@@ -54,9 +54,9 @@ namespace Octokit.Tests.Http
|
||||
httpClient,
|
||||
Substitute.For<IJsonSerializer>());
|
||||
|
||||
await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative));
|
||||
await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative));
|
||||
await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative));
|
||||
await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative));
|
||||
await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative));
|
||||
await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative));
|
||||
|
||||
httpClient.Received(3).Send<string>(Arg.Is<IRequest>(req =>
|
||||
req.BaseAddress == ExampleUri &&
|
||||
@@ -83,7 +83,7 @@ namespace Octokit.Tests.Http
|
||||
httpClient,
|
||||
Substitute.For<IJsonSerializer>());
|
||||
|
||||
var resp = await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative));
|
||||
var resp = await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative));
|
||||
Assert.NotNull(resp.ApiInfo);
|
||||
Assert.Equal("user", resp.ApiInfo.AcceptedOauthScopes.First());
|
||||
}
|
||||
@@ -101,7 +101,7 @@ namespace Octokit.Tests.Http
|
||||
Substitute.For<IJsonSerializer>());
|
||||
|
||||
var exception = await AssertEx.Throws<AuthorizationException>(
|
||||
async () => await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
async () => await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
Assert.NotNull(exception);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace Octokit.Tests.Http
|
||||
Substitute.For<IJsonSerializer>());
|
||||
|
||||
var exception = await AssertEx.Throws<AuthorizationException>(
|
||||
async () => await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
async () => await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
Assert.Equal(HttpStatusCode.Unauthorized, exception.StatusCode);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace Octokit.Tests.Http
|
||||
Substitute.For<IJsonSerializer>());
|
||||
|
||||
var exception = await AssertEx.Throws<TwoFactorRequiredException>(
|
||||
async () => await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
async () => await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
|
||||
Assert.Equal(expectedFactorType, exception.TwoFactorType);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ namespace Octokit.Tests.Http
|
||||
Substitute.For<IJsonSerializer>());
|
||||
|
||||
var exception = await AssertEx.Throws<ApiValidationException>(
|
||||
async () => await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
async () => await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
|
||||
Assert.Equal("Validation Failed", exception.Message);
|
||||
Assert.Equal("key is already in use", exception.ApiError.Errors[0].Message);
|
||||
@@ -202,7 +202,7 @@ namespace Octokit.Tests.Http
|
||||
Substitute.For<IJsonSerializer>());
|
||||
|
||||
var exception = await AssertEx.Throws<RateLimitExceededException>(
|
||||
async () => await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
async () => await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
|
||||
Assert.Equal("API rate limit exceeded. See http://developer.github.com/v3/#rate-limiting for details.",
|
||||
exception.Message);
|
||||
@@ -226,7 +226,7 @@ namespace Octokit.Tests.Http
|
||||
Substitute.For<IJsonSerializer>());
|
||||
|
||||
var exception = await AssertEx.Throws<LoginAttemptsExceededException>(
|
||||
async () => await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
async () => await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
|
||||
Assert.Equal("Maximum number of login attempts exceeded", exception.Message);
|
||||
Assert.Equal("http://developer.github.com/v3", exception.ApiError.DocumentationUrl);
|
||||
@@ -249,7 +249,7 @@ namespace Octokit.Tests.Http
|
||||
Substitute.For<IJsonSerializer>());
|
||||
|
||||
var exception = await AssertEx.Throws<NotFoundException>(
|
||||
async () => await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
async () => await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
|
||||
Assert.Equal("GONE BYE BYE!", exception.Message);
|
||||
}
|
||||
@@ -271,7 +271,7 @@ namespace Octokit.Tests.Http
|
||||
Substitute.For<IJsonSerializer>());
|
||||
|
||||
var exception = await AssertEx.Throws<ForbiddenException>(
|
||||
async () => await connection.GetAsync<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
async () => await connection.GetResponse<string>(new Uri("endpoint", UriKind.Relative)));
|
||||
|
||||
Assert.Equal("YOU SHALL NOT PASS!", exception.Message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user