Browse files

Added tests for associate requests with session_type and not assoc_type.

  • Loading branch information...
1 parent d76714f commit 92325e661aae45684cb56ebe9a0f0be462b914ec @ziima committed Jun 6, 2011
Showing with 14 additions and 0 deletions.
  1. +14 −0 openid/test/test_server.py
View
14 openid/test/test_server.py
@@ -720,6 +720,7 @@ def test_cancelToForm(self):
def test_assocReply(self):
msg = Message(OPENID2_NS)
msg.setArg(OPENID2_NS, 'session_type', 'no-encryption')
+ msg.setArg(OPENID2_NS, 'assoc_type', 'HMAC-SHA1')
request = server.AssociateRequest.fromMessage(msg)
response = server.OpenIDResponse(request)
response.fields = Message.fromPostArgs(
@@ -845,6 +846,7 @@ def test_cancel(self):
def test_assocReply(self):
msg = Message(OPENID2_NS)
msg.setArg(OPENID2_NS, 'session_type', 'no-encryption')
+ msg.setArg(OPENID2_NS, 'assoc_type', 'HMAC-SHA1')
request = server.AssociateRequest.fromMessage(msg)
response = server.OpenIDResponse(request)
response.fields = Message.fromOpenIDArgs({'assoc_handle': "every-zig"})
@@ -1713,6 +1715,7 @@ def test_associate2(self):
msg = Message.fromPostArgs({
'openid.ns': OPENID2_NS,
'openid.session_type': 'no-encryption',
+ 'openid.assoc_type': 'HMAC-SHA1',
})
request = server.AssociateRequest.fromMessage(msg)
@@ -1735,6 +1738,7 @@ def test_associate3(self):
msg = Message.fromPostArgs({
'openid.ns': OPENID2_NS,
'openid.session_type': 'no-encryption',
+ 'openid.assoc_type': 'HMAC-SHA1',
})
request = server.AssociateRequest.fromMessage(msg)
@@ -1777,6 +1781,16 @@ def test_missingSessionTypeOpenID2(self):
self.assertRaises(server.ProtocolError,
server.AssociateRequest.fromMessage, msg)
+ def test_missingAssocTypeOpenID2(self):
+ """Make sure assoc_type is required in OpenID 2"""
+ msg = Message.fromPostArgs({
+ 'openid.ns': OPENID2_NS,
+ 'openid.session_type': 'no-encryption',
+ })
+
+ self.assertRaises(server.ProtocolError,
+ server.AssociateRequest.fromMessage, msg)
+
def test_checkAuth(self):
request = server.CheckAuthRequest('arrrrrf', '0x3999', [])
response = self.server.openid_check_authentication(request)

0 comments on commit 92325e6

Please sign in to comment.