1
2 from unittest import TestCase
3 from openid.yadis import xrires
4
7 self.proxy_url = 'http://xri.example.com/'
8 self.proxy = xrires.ProxyResolver(self.proxy_url)
9 self.servicetype = 'xri://+i-service*(+forwarding)*($v*1.0)'
10 self.servicetype_enc = 'xri%3A%2F%2F%2Bi-service%2A%28%2Bforwarding%29%2A%28%24v%2A1.0%29'
11
12
14 st = self.servicetype
15 ste = self.servicetype_enc
16 args_esc = "_xrd_r=application%2Fxrds%2Bxml&_xrd_t=" + ste
17 pqu = self.proxy.queryURL
18 h = self.proxy_url
19 self.failUnlessEqual(h + '=foo?' + args_esc, pqu('=foo', st))
20 self.failUnlessEqual(h + '=foo/bar?baz&' + args_esc,
21 pqu('=foo/bar?baz', st))
22 self.failUnlessEqual(h + '=foo/bar?baz=quux&' + args_esc,
23 pqu('=foo/bar?baz=quux', st))
24 self.failUnlessEqual(h + '=foo/bar?mi=fa&so=la&' + args_esc,
25 pqu('=foo/bar?mi=fa&so=la', st))
26
27
28 args_esc = "_xrd_r=application%2Fxrds%2Bxml%3Bsep%3Dfalse"
29 self.failUnlessEqual(h + '=foo?' + args_esc, pqu('=foo', None))
30
31
33 st = self.servicetype
34 ste = self.servicetype_enc
35 args_esc = "_xrd_r=application%2Fxrds%2Bxml&_xrd_t=" + ste
36 pqu = self.proxy.queryURL
37 h = self.proxy_url
38 self.failUnlessEqual(h + '=foo/bar??' + args_esc, pqu('=foo/bar?', st))
39 self.failUnlessEqual(h + '=foo/bar????' + args_esc,
40 pqu('=foo/bar???', st))
41