comparison tests/test-hgweb-auth.py @ 37940:31c37e703cee

tests: use stringutil.pprint instead of custom dumper in test-hgweb-auth.py Differential Revision: https://phab.mercurial-scm.org/D3529
author Augie Fackler <augie@google.com>
date Fri, 27 Apr 2018 13:46:54 -0400
parents 58c1368ab629
children 32bc3815efae
comparison
equal deleted inserted replaced
37939:6eca47f6319d 37940:31c37e703cee
1 from __future__ import absolute_import, print_function 1 from __future__ import absolute_import, print_function
2 2
3 from mercurial import demandimport; demandimport.enable() 3 from mercurial import demandimport; demandimport.enable()
4 from mercurial import ( 4 from mercurial import (
5 error, 5 error,
6 pycompat,
6 ui as uimod, 7 ui as uimod,
7 url, 8 url,
8 util, 9 util,
10 )
11 from mercurial.utils import (
12 stringutil,
9 ) 13 )
10 14
11 urlerr = util.urlerr 15 urlerr = util.urlerr
12 urlreq = util.urlreq 16 urlreq = util.urlreq
13 17
21 ui = origui.copy() 25 ui = origui.copy()
22 for name, value in items.items(): 26 for name, value in items.items():
23 ui.setconfig('auth', name, value) 27 ui.setconfig('auth', name, value)
24 return ui 28 return ui
25 29
26 def dumpdict(dict):
27 return '{' + ', '.join(['%s: %s' % (k, dict[k])
28 for k in sorted(dict)]) + '}'
29
30 def test(auth, urls=None): 30 def test(auth, urls=None):
31 print('CFG:', dumpdict(auth)) 31 print('CFG:', pycompat.sysstr(stringutil.pprint(auth)))
32 prefixes = set() 32 prefixes = set()
33 for k in auth: 33 for k in auth:
34 prefixes.add(k.split('.', 1)[0]) 34 prefixes.add(k.split('.', 1)[0])
35 for p in prefixes: 35 for p in prefixes:
36 for name in ('.username', '.password'): 36 for name in ('.username', '.password'):