comparison tests/test-hgweb-auth.py @ 10282:08a0f04b56bd

many, many trivial check-code fixups
author Matt Mackall <mpm@selenic.com>
date Mon, 25 Jan 2010 00:05:27 -0600
parents 89c80c3dc584
children 4a43e23b8c55
comparison
equal deleted inserted replaced
10281:e7d3b509af8b 10282:08a0f04b56bd
14 for name, value in items.iteritems(): 14 for name, value in items.iteritems():
15 ui.setconfig('auth', name, value) 15 ui.setconfig('auth', name, value)
16 return ui 16 return ui
17 17
18 def dumpdict(dict): 18 def dumpdict(dict):
19 return '{' + ', '.join(['%s: %s' % (k, dict[k]) for k in sorted(dict.iterkeys())]) + '}' 19 return '{' + ', '.join(['%s: %s' % (k, dict[k])
20 for k in sorted(dict.iterkeys())]) + '}'
20 21
21 def test(auth): 22 def test(auth):
22 print 'CFG:', dumpdict(auth) 23 print 'CFG:', dumpdict(auth)
23 prefixes = set() 24 prefixes = set()
24 for k in auth: 25 for k in auth:
54 test({'x.prefix': 'example.org', 'x.schemes': 'http'}) 55 test({'x.prefix': 'example.org', 'x.schemes': 'http'})
55 test({'x.prefix': 'example.org', 'x.schemes': 'https'}) 56 test({'x.prefix': 'example.org', 'x.schemes': 'https'})
56 test({'x.prefix': 'example.org', 'x.schemes': 'http https'}) 57 test({'x.prefix': 'example.org', 'x.schemes': 'http https'})
57 58
58 print '\n*** Test prefix matching\n' 59 print '\n*** Test prefix matching\n'
59 test({'x.prefix': 'http://example.org/foo', 'y.prefix': 'http://example.org/bar'}) 60 test({'x.prefix': 'http://example.org/foo',
60 test({'x.prefix': 'http://example.org/foo', 'y.prefix': 'http://example.org/foo/bar'}) 61 'y.prefix': 'http://example.org/bar'})
62 test({'x.prefix': 'http://example.org/foo',
63 'y.prefix': 'http://example.org/foo/bar'})
61 test({'x.prefix': '*', 'y.prefix': 'https://example.org/bar'}) 64 test({'x.prefix': '*', 'y.prefix': 'https://example.org/bar'})