Skip to content

Commit 572f61c

Browse files
author
tailor
committed
[project @ Add AX.fromSuccessResponse test with data]
1 parent aee84bb commit 572f61c

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎openid/test/test_ax.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,30 @@ class Endpoint:
546546
r = ax.FetchResponse.fromSuccessResponse(oreq)
547547
self.failUnless(r is not None)
548548

549+
def test_fromSuccessResponseWithData(self):
550+
name = 'ext0'
551+
value = 'snozzberry'
552+
uri = "http://willy.wonka.name/"
553+
args = {
554+
'mode': 'id_res',
555+
'ns': OPENID2_NS,
556+
'ns.ax': ax.AXMessage.ns_uri,
557+
'ax.update_url': 'http://example.com/realm/update_path',
558+
'ax.mode': 'fetch_response',
559+
'ax.type.'+name: uri,
560+
'ax.count.'+name: '1',
561+
'ax.value.%s.1'%name: value,
562+
}
563+
sf = ['openid.' + i for i in args.keys()]
564+
msg = Message.fromOpenIDArgs(args)
565+
class Endpoint:
566+
claimed_id = 'http://invalid.'
567+
568+
resp = SuccessResponse(Endpoint(), msg, signed_fields=sf)
569+
ax_resp = ax.FetchResponse.fromSuccessResponse(resp)
570+
values = ax_resp.get(uri)
571+
self.failUnlessEqual([value], values)
572+
549573

550574
class StoreRequestTest(unittest.TestCase):
551575
def setUp(self):

0 commit comments

Comments
 (0)