Mercurial > hg
comparison tests/test-hgweb-auth.py @ 36327:58c1368ab629
py3: use dict.items() instead of dict.iteritems() in tests
dict.iteritems() is not present in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D2353
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 19 Feb 2018 21:18:52 +0530 |
parents | ba479850c9c7 |
children | 31c37e703cee |
comparison
equal
deleted
inserted
replaced
36326:a2cbff474821 | 36327:58c1368ab629 |
---|---|
17 | 17 |
18 origui = myui.load() | 18 origui = myui.load() |
19 | 19 |
20 def writeauth(items): | 20 def writeauth(items): |
21 ui = origui.copy() | 21 ui = origui.copy() |
22 for name, value in items.iteritems(): | 22 for name, value in items.items(): |
23 ui.setconfig('auth', name, value) | 23 ui.setconfig('auth', name, value) |
24 return ui | 24 return ui |
25 | 25 |
26 def dumpdict(dict): | 26 def dumpdict(dict): |
27 return '{' + ', '.join(['%s: %s' % (k, dict[k]) | 27 return '{' + ', '.join(['%s: %s' % (k, dict[k]) |
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'): |
37 if (p + name) not in auth: | 37 if (p + name) not in auth: |
38 auth[p + name] = p | 38 auth[p + name] = p |
39 auth = dict((k, v) for k, v in auth.iteritems() if v is not None) | 39 auth = dict((k, v) for k, v in auth.items() if v is not None) |
40 | 40 |
41 ui = writeauth(auth) | 41 ui = writeauth(auth) |
42 | 42 |
43 def _test(uri): | 43 def _test(uri): |
44 print('URI:', uri) | 44 print('URI:', uri) |