introduce ApplicationAuthorization which contains raw token result

This commit is contained in:
Brendan Forster
2015-01-02 13:09:50 +09:30
parent 9db29d4a69
commit d613cef196
16 changed files with 71 additions and 48 deletions
@@ -16,11 +16,11 @@ namespace Octokit.Tests.Reactive
{
var firstResponse = new TwoFactorRequiredException(TwoFactorType.AuthenticatorApp);
var twoFactorChallengeResult = new TwoFactorChallengeResult("two-factor-code");
var secondResponse = new Authorization {Token = "OAUTHSECRET"};
var secondResponse = new ApplicationAuthorization { Token = "OAUTHSECRET" };
var client = Substitute.For<IObservableAuthorizationsClient>();
client.GetOrCreateApplicationAuthentication(Args.String, Args.String, Args.NewAuthorization)
.Returns(Observable.Throw<Authorization>(firstResponse));
.Returns(Observable.Throw<ApplicationAuthorization>(firstResponse));
client.GetOrCreateApplicationAuthentication(
Args.String,
Args.String,
@@ -51,11 +51,11 @@ namespace Octokit.Tests.Reactive
TwoFactorChallengeResult.RequestResendCode,
new TwoFactorChallengeResult("two-factor-code")
});
var secondResponse = new Authorization { Token = "OAUTHSECRET" };
var secondResponse = new ApplicationAuthorization { Token = "OAUTHSECRET" };
var client = Substitute.For<IObservableAuthorizationsClient>();
client.GetOrCreateApplicationAuthentication(Args.String, Args.String, Args.NewAuthorization)
.Returns(Observable.Throw<Authorization>(firstResponse));
.Returns(Observable.Throw<ApplicationAuthorization>(firstResponse));
client.GetOrCreateApplicationAuthentication(
Args.String,
Args.String,
@@ -90,13 +90,13 @@ namespace Octokit.Tests.Reactive
var data = new NewAuthorization();
var client = Substitute.For<IObservableAuthorizationsClient>();
client.GetOrCreateApplicationAuthentication("clientId", "secret", Arg.Any<NewAuthorization>())
.Returns(Observable.Throw<Authorization>(new TwoFactorRequiredException()));
.Returns(Observable.Throw<ApplicationAuthorization>(new TwoFactorRequiredException()));
client.GetOrCreateApplicationAuthentication("clientId",
"secret",
Arg.Any<NewAuthorization>(),
"wrong-code")
.Returns(Observable.Throw<Authorization>(twoFactorFailedException));
var observer = Substitute.For<System.IObserver<Authorization>>();
.Returns(Observable.Throw<ApplicationAuthorization>(twoFactorFailedException));
var observer = Substitute.For<System.IObserver<ApplicationAuthorization>>();
client.GetOrCreateApplicationAuthentication(
"clientId",