changeset 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 6eca47f6319d
children af83a0ed0afb
files tests/test-hgweb-auth.py tests/test-hgweb-auth.py.out
diffstat 2 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-hgweb-auth.py	Fri Apr 27 13:43:59 2018 -0400
+++ b/tests/test-hgweb-auth.py	Fri Apr 27 13:46:54 2018 -0400
@@ -3,10 +3,14 @@
 from mercurial import demandimport; demandimport.enable()
 from mercurial import (
     error,
+    pycompat,
     ui as uimod,
     url,
     util,
 )
+from mercurial.utils import (
+    stringutil,
+)
 
 urlerr = util.urlerr
 urlreq = util.urlreq
@@ -23,12 +27,8 @@
         ui.setconfig('auth', name, value)
     return ui
 
-def dumpdict(dict):
-    return '{' + ', '.join(['%s: %s' % (k, dict[k])
-                            for k in sorted(dict)]) + '}'
-
 def test(auth, urls=None):
-    print('CFG:', dumpdict(auth))
+    print('CFG:', pycompat.sysstr(stringutil.pprint(auth)))
     prefixes = set()
     for k in auth:
         prefixes.add(k.split('.', 1)[0])
--- a/tests/test-hgweb-auth.py.out	Fri Apr 27 13:43:59 2018 -0400
+++ b/tests/test-hgweb-auth.py.out	Fri Apr 27 13:46:54 2018 -0400
@@ -1,7 +1,7 @@
 
 *** Test in-uri schemes
 
-CFG: {x.prefix: http://example.org}
+CFG: {b'x.prefix': b'http://example.org'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -18,7 +18,7 @@
      abort
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: https://example.org}
+CFG: {b'x.prefix': b'https://example.org'}
 URI: http://example.org/foo
      abort
 URI: http://example.org/foo/bar
@@ -35,7 +35,7 @@
      ('x', 'x')
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: http://example.org, x.schemes: https}
+CFG: {b'x.prefix': b'http://example.org', b'x.schemes': b'https'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -52,7 +52,7 @@
      abort
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: https://example.org, x.schemes: http}
+CFG: {b'x.prefix': b'https://example.org', b'x.schemes': b'http'}
 URI: http://example.org/foo
      abort
 URI: http://example.org/foo/bar
@@ -72,7 +72,7 @@
 
 *** Test separately configured schemes
 
-CFG: {x.prefix: example.org, x.schemes: http}
+CFG: {b'x.prefix': b'example.org', b'x.schemes': b'http'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -89,7 +89,7 @@
      abort
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: example.org, x.schemes: https}
+CFG: {b'x.prefix': b'example.org', b'x.schemes': b'https'}
 URI: http://example.org/foo
      abort
 URI: http://example.org/foo/bar
@@ -106,7 +106,7 @@
      ('x', 'x')
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: example.org, x.schemes: http https}
+CFG: {b'x.prefix': b'example.org', b'x.schemes': b'http https'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -126,7 +126,7 @@
 
 *** Test prefix matching
 
-CFG: {x.prefix: http://example.org/foo, y.prefix: http://example.org/bar}
+CFG: {b'x.prefix': b'http://example.org/foo', b'y.prefix': b'http://example.org/bar'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -143,7 +143,7 @@
      abort
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: http://example.org/foo, y.prefix: http://example.org/foo/bar}
+CFG: {b'x.prefix': b'http://example.org/foo', b'y.prefix': b'http://example.org/foo/bar'}
 URI: http://example.org/foo
      ('x', 'x')
 URI: http://example.org/foo/bar
@@ -160,7 +160,7 @@
      abort
 URI: https://y@example.org/bar
      abort
-CFG: {x.prefix: *, y.prefix: https://example.org/bar}
+CFG: {b'x.prefix': b'*', b'y.prefix': b'https://example.org/bar'}
 URI: http://example.org/foo
      abort
 URI: http://example.org/foo/bar
@@ -180,13 +180,13 @@
 
 *** Test user matching
 
-CFG: {x.password: xpassword, x.prefix: http://example.org/foo, x.username: None}
+CFG: {b'x.password': b'xpassword', b'x.prefix': b'http://example.org/foo', b'x.username': None}
 URI: http://y@example.org/foo
      ('y', 'xpassword')
-CFG: {x.password: xpassword, x.prefix: http://example.org/foo, x.username: None, y.password: ypassword, y.prefix: http://example.org/foo, y.username: y}
+CFG: {b'x.password': b'xpassword', b'x.prefix': b'http://example.org/foo', b'x.username': None, b'y.password': b'ypassword', b'y.prefix': b'http://example.org/foo', b'y.username': b'y'}
 URI: http://y@example.org/foo
      ('y', 'ypassword')
-CFG: {x.password: xpassword, x.prefix: http://example.org/foo/bar, x.username: None, y.password: ypassword, y.prefix: http://example.org/foo, y.username: y}
+CFG: {b'x.password': b'xpassword', b'x.prefix': b'http://example.org/foo/bar', b'x.username': None, b'y.password': b'ypassword', b'y.prefix': b'http://example.org/foo', b'y.username': b'y'}
 URI: http://y@example.org/foo/bar
      ('y', 'xpassword')