incubator-heraldry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ket...@apache.org
Subject svn commit: r493381 - in /incubator/heraldry/libraries/python/openid/trunk: admin/runtests openid/test/test_auth_request.py
Date Sat, 06 Jan 2007 05:26:32 GMT
Author: keturn
Date: Fri Jan  5 21:26:32 2007
New Revision: 493381

URL: http://svn.apache.org/viewvc?view=rev&rev=493381
Log:
[python-to-heraldry @ Refactor test_auth_request methods, fix typos, add test_auth_request
to test lineup]

Original author: cygnus@janrain.com
Date: 2006-12-27 19:16:57+00:00

Modified:
    incubator/heraldry/libraries/python/openid/trunk/admin/runtests
    incubator/heraldry/libraries/python/openid/trunk/openid/test/test_auth_request.py

Modified: incubator/heraldry/libraries/python/openid/trunk/admin/runtests
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/admin/runtests?view=diff&rev=493381&r1=493380&r2=493381
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/admin/runtests (original)
+++ incubator/heraldry/libraries/python/openid/trunk/admin/runtests Fri Jan  5 21:26:32 2007
@@ -58,6 +58,7 @@
     from openid.test import linkparse
     from openid.test import trustroot
     from openid.test import test_association
+    from openid.test import test_auth_request
     from openid.test import test_fetchers
     from openid.test import test_urinorm
     from openid.test import test_nonce
@@ -79,6 +80,7 @@
         test_xri,
         test_xrires,
         test_association_response,
+        test_auth_request,
         ]
 
     # Some modules have data-driven tests, and they use custom methods

Modified: incubator/heraldry/libraries/python/openid/trunk/openid/test/test_auth_request.py
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/openid/test/test_auth_request.py?view=diff&rev=493381&r1=493380&r2=493381
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/openid/test/test_auth_request.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/openid/test/test_auth_request.py Fri
Jan  5 21:26:32 2007
@@ -46,27 +46,21 @@
 
     def failUnlessOpenIDValueEquals(self, msg, key, expected, ns=None):
         if ns is None:
-            ns = OPENID_NS
+            ns = message.OPENID_NS
 
-        actual = msg.getKey(ns, key)
+        actual = msg.getArg(ns, key)
         error_format = 'Wrong value for openid.%s: expected=%s, actual=%s'
-        error_message = error_format %  % (key, expected, actual))
+        error_message = error_format % (key, expected, actual)
         self.failUnlessEqual(expected, actual, error_message)
 
     def failIfOpenIDKeyExists(self, msg, key, ns=None):
         if ns is None:
-            ns = OPENID_NS
+            ns = message.OPENID_NS
 
-        actual = msg.getKey(ns, key)
+        actual = msg.getArg(ns, key)
         error_message = 'openid.%s unexpectedly present: %s' % (key, actual)
         self.failIf(actual is not None, error_message)
 
-    def test_justConstruct(self):
-        """Make sure that the internal state of the AuthRequest
-        matches what we put in during construction"""
-        self.failUnlessEqual(self.preferred_namespace,
-                             self.authreq.message.getOpenIDNamespace())
-
     def test_addExtensionArg(self):
         self.authreq.addExtensionArg('bag:', 'color', 'brown')
         self.authreq.addExtensionArg('bag:', 'material', 'paper')
@@ -84,6 +78,20 @@
         self.failUnlessEqual('brown', post_args['openid.0.color'])
         self.failUnlessEqual('paper', post_args['openid.0.material'])
 
+    def test_standard(self):
+        msg = self.authreq.getMessage(self.realm, self.return_to)
+
+        self.failUnlessHasIdentifiers(
+            msg, self.endpoint.local_id, self.endpoint.claimed_id)
+
+        self.failUnlessEqual(self.preferred_namespace,
+                             self.authreq.message.getOpenIDNamespace())
+
+        self.failUnlessEqual(self.preferred_namespace,
+                             msg.getOpenIDNamespace())
+
+        self.failUnlessOpenIDValueEquals(msg, 'mode', 'checkid_setup')
+
 class TestAuthRequestOpenID2(TestAuthRequestBase, unittest.TestCase):
     preferred_namespace = message.OPENID2_NS
 
@@ -91,11 +99,6 @@
         self.failUnlessOpenIDValueEquals(msg, 'identity', op_specific_id)
         self.failUnlessOpenIDValueEquals(msg, 'claimed_id', claimed_id)
 
-    def test_standard(self):
-        msg = self.authreq.getMessage(self.realm, self.return_to)
-        self.failUnlessHasIdentifiers(
-            msg, self.endpoint.local_id, self.endpoint.claimed_id)
-
     def test_setAnonymousWorksForOpenID2(self):
         """OpenID AuthRequests should be able to set 'anonymous' to true."""
         self.failUnless(self.authreq.message.isOpenID2())
@@ -155,6 +158,11 @@
         self.failIf(msg.getArg(message.OPENID1_NS, 'realm'))
         self.failUnlessEqual(self.realm,
                              msg.getArg(message.OPENID1_NS, 'trust_root'))
+
+    def failUnlessHasIdentifiers(self, msg, op_specific_id, claimed_id):
+        """Make sure claimed_is is *absent* in request."""
+        self.failUnlessOpenIDValueEquals(msg, 'identity', op_specific_id)
+        self.failIfOpenIDKeyExists(msg, 'claimed_id')
 
 if __name__ == '__main__':
     unittest.main()



Mime
View raw message