diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-01-29 16:52:00 -0800 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2009-01-29 16:52:00 -0800 |
commit | f152c066e5c3e0bf9bf7b4938dd996083dcc9399 (patch) | |
tree | 135a546630d769f7188e724b35e3862879f06aa2 /src/DotNetOpenAuth.Test/OAuth/ChannelElements | |
parent | c701066381fc2c73bec4f63981d7637aa33b713b (diff) | |
download | DotNetOpenAuth-f152c066e5c3e0bf9bf7b4938dd996083dcc9399.zip DotNetOpenAuth-f152c066e5c3e0bf9bf7b4938dd996083dcc9399.tar.gz DotNetOpenAuth-f152c066e5c3e0bf9bf7b4938dd996083dcc9399.tar.bz2 |
OpenID error direct response messages are now sent with HTTP status codes of 400.
Diffstat (limited to 'src/DotNetOpenAuth.Test/OAuth/ChannelElements')
-rw-r--r-- | src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs index a74a622..fb725d4 100644 --- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs +++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs @@ -22,6 +22,7 @@ namespace DotNetOpenAuth.Test.ChannelElements { [TestClass] public class OAuthChannelTests : TestBase { private OAuthChannel channel; + private OAuthChannel_Accessor accessor; private TestWebRequestHandler webRequestHandler; private SigningBindingElementBase signingElement; private INonceStore nonceStore; @@ -34,6 +35,7 @@ namespace DotNetOpenAuth.Test.ChannelElements { this.signingElement = new RsaSha1SigningBindingElement(); this.nonceStore = new NonceMemoryStore(StandardExpirationBindingElement.DefaultMaximumMessageAge); this.channel = new OAuthChannel(this.signingElement, this.nonceStore, new InMemoryTokenManager(), new TestMessageFactory()); + this.accessor = OAuthChannel_Accessor.AttachShadow(this.channel); this.channel.WebRequestHandler = this.webRequestHandler; } @@ -276,5 +278,21 @@ namespace DotNetOpenAuth.Test.ChannelElements { Assert.AreEqual("Andrew", testMessage.Name); Assert.AreEqual("http://hostb/pathB", testMessage.Location.AbsoluteUri); } + + /// <summary> + /// Verifies that messages asking for special HTTP status codes get them. + /// </summary> + [TestMethod] + public void SendDirectMessageResponseHonorsHttpStatusCodes() { + IProtocolMessage message = MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired); + UserAgentResponse directResponse = this.accessor.SendDirectMessageResponse(message); + Assert.AreEqual(HttpStatusCode.OK, directResponse.Status); + + var httpMessage = new TestDirectResponseMessageWithHttpStatus(); + MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired, httpMessage); + httpMessage.HttpStatusCode = HttpStatusCode.NotAcceptable; + directResponse = this.accessor.SendDirectMessageResponse(httpMessage); + Assert.AreEqual(HttpStatusCode.NotAcceptable, directResponse.Status); + } } } |