annotate tests/test-trusted.py @ 36611:6906547c8476

wireproto: don't expose legacy commands to version 2 of wire protocol Now that we have the ability to control which transports a wire protocol command is exposed on, let's put it to use. We flag the "branches," "changegroup," and "changegroupsubset" commands as only available on version 1. "branches" was used by the legacy discovery mechanism and was replaced by the "known" and "heads" commands. "changegroup" and "changegroupsubset" were replaced by "getbundle." "between" is also legacy. However, since it is used by the SSH handshake protocol, marking it as legacy is a bit more complicated and will be done in a later commit. Another nuanced issue with this change is that the server-advertised capabilities still list "changegroupsubset" despite the command not being available. This will be addressed in a subsequent commit. Differential Revision: https://phab.mercurial-scm.org/D2485
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 27 Feb 2018 15:06:10 -0800
parents 85a2db47ad50
children 73ccba60aaa1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
1 # Since it's not easy to write a test that portably deals
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
2 # with files from different users/groups, we cheat a bit by
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
3 # monkey-patching some functions in the util module
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
4
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
5 from __future__ import absolute_import, print_function
28913
b4048ce003fb tests: make test-trusted use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26587
diff changeset
6
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
7 import os
28913
b4048ce003fb tests: make test-trusted use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26587
diff changeset
8 from mercurial import (
b4048ce003fb tests: make test-trusted use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26587
diff changeset
9 error,
b4048ce003fb tests: make test-trusted use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26587
diff changeset
10 ui as uimod,
b4048ce003fb tests: make test-trusted use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26587
diff changeset
11 util,
b4048ce003fb tests: make test-trusted use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 26587
diff changeset
12 )
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
13
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
14 hgrc = os.environ['HGRCPATH']
5523
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4516
diff changeset
15 f = open(hgrc)
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4516
diff changeset
16 basehgrc = f.read()
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4516
diff changeset
17 f.close()
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
18
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
19 def testui(user='foo', group='bar', tusers=(), tgroups=(),
13493
95b0d4c1c9e1 ui: always report untrusted hgrc files when debug enabled
Ry4an Brase <ry4an-hg@ry4an.org>
parents: 11291
diff changeset
20 cuser='foo', cgroup='bar', debug=False, silent=False,
95b0d4c1c9e1 ui: always report untrusted hgrc files when debug enabled
Ry4an Brase <ry4an-hg@ry4an.org>
parents: 11291
diff changeset
21 report=True):
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
22 # user, group => owners of the file
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
23 # tusers, tgroups => trusted users/groups
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
24 # cuser, cgroup => user/group of the current process
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
25
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
26 # write a global hgrc with the list of trusted users/groups and
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
27 # some setting so that we can be sure it was read
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
28 f = open(hgrc, 'w')
5523
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4516
diff changeset
29 f.write(basehgrc)
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4516
diff changeset
30 f.write('\n[paths]\n')
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
31 f.write('global = /some/path\n\n')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
32
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
33 if tusers or tgroups:
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
34 f.write('[trusted]\n')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
35 if tusers:
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
36 f.write('users = %s\n' % ', '.join(tusers))
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
37 if tgroups:
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
38 f.write('groups = %s\n' % ', '.join(tgroups))
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
39 f.close()
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
40
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
41 # override the functions that give names to uids and gids
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
42 def username(uid=None):
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
43 if uid is None:
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
44 return cuser
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
45 return user
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
46 util.username = username
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
47
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
48 def groupname(gid=None):
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
49 if gid is None:
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
50 return 'bar'
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
51 return group
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
52 util.groupname = groupname
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
53
8657
3fa92c618624 posix: do not use fstat in isowner
Martin Geisler <mg@lazybytes.net>
parents: 8190
diff changeset
54 def isowner(st):
3677
1a0fa3914c46 Avoid looking up usernames if the current user owns the .hgrc file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3552
diff changeset
55 return user == cuser
1a0fa3914c46 Avoid looking up usernames if the current user owns the .hgrc file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3552
diff changeset
56 util.isowner = isowner
1a0fa3914c46 Avoid looking up usernames if the current user owns the .hgrc file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3552
diff changeset
57
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
58 # try to read everything
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
59 #print '# File belongs to user %s, group %s' % (user, group)
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
60 #print '# trusted users = %s; trusted groups = %s' % (tusers, tgroups)
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
61 kind = ('different', 'same')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
62 who = ('', 'user', 'group', 'user and the group')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
63 trusted = who[(user in tusers) + 2*(group in tgroups)]
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
64 if trusted:
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
65 trusted = ', but we trust the ' + trusted
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
66 print('# %s user, %s group%s' % (kind[user == cuser], kind[group == cgroup],
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
67 trusted))
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
68
30559
d83ca854fa21 ui: factor out ui.load() to create a ui without loading configs (API)
Yuya Nishihara <yuya@tcha.org>
parents: 28934
diff changeset
69 u = uimod.ui.load()
34858
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
70 # disable the configuration registration warning
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
71 #
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
72 # the purpose of this test is to check the old behavior, not to validate the
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
73 # behavior from registered item. so we silent warning related to unregisted
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
74 # config.
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
75 u.setconfig('devel', 'warn-config-unknown', False, 'test')
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
76 u.setconfig('devel', 'all-warnings', False, 'test')
8190
9b8ac5fb7760 ui: kill most users of parentui name and arg, replace with .copy()
Matt Mackall <mpm@selenic.com>
parents: 8144
diff changeset
77 u.setconfig('ui', 'debug', str(bool(debug)))
13493
95b0d4c1c9e1 ui: always report untrusted hgrc files when debug enabled
Ry4an Brase <ry4an-hg@ry4an.org>
parents: 11291
diff changeset
78 u.setconfig('ui', 'report_untrusted', str(bool(report)))
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
79 u.readconfig('.hg/hgrc')
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
80 if silent:
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
81 return u
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
82 print('trusted')
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
83 for name, path in u.configitems('paths'):
31857
08fbc97d1364 tests: print Unix style paths in *.py tests
Matt Harbison <matt_harbison@yahoo.com>
parents: 31472
diff changeset
84 print(' ', name, '=', util.pconvert(path))
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
85 print('untrusted')
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
86 for name, path in u.configitems('paths', untrusted=True):
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
87 print('.', end=' ')
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
88 u.config('paths', name) # warning with debug=True
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
89 print('.', end=' ')
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
90 u.config('paths', name, untrusted=True) # no warnings
31857
08fbc97d1364 tests: print Unix style paths in *.py tests
Matt Harbison <matt_harbison@yahoo.com>
parents: 31472
diff changeset
91 print(name, '=', util.pconvert(path))
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
92 print()
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
93
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
94 return u
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
95
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
96 os.mkdir('repo')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
97 os.chdir('repo')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
98 os.mkdir('.hg')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
99 f = open('.hg/hgrc', 'w')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
100 f.write('[paths]\n')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
101 f.write('local = /another/path\n\n')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
102 f.close()
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
103
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
104 #print '# Everything is run by user foo, group bar\n'
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
105
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
106 # same user, same group
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
107 testui()
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
108 # same user, different group
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
109 testui(group='def')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
110 # different user, same group
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
111 testui(user='abc')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
112 # ... but we trust the group
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
113 testui(user='abc', tgroups=['bar'])
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
114 # different user, different group
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
115 testui(user='abc', group='def')
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
116 # ... but we trust the user
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
117 testui(user='abc', group='def', tusers=['abc'])
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
118 # ... but we trust the group
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
119 testui(user='abc', group='def', tgroups=['def'])
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
120 # ... but we trust the user and the group
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
121 testui(user='abc', group='def', tusers=['abc'], tgroups=['def'])
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
122 # ... but we trust all users
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
123 print('# we trust all users')
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
124 testui(user='abc', group='def', tusers=['*'])
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
125 # ... but we trust all groups
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
126 print('# we trust all groups')
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
127 testui(user='abc', group='def', tgroups=['*'])
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
128 # ... but we trust the whole universe
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
129 print('# we trust all users and groups')
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
130 testui(user='abc', group='def', tusers=['*'], tgroups=['*'])
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
131 # ... check that users and groups are in different namespaces
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
132 print("# we don't get confused by users and groups with the same name")
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
133 testui(user='abc', group='def', tusers=['def'], tgroups=['abc'])
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
134 # ... lists of user names work
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
135 print("# list of user names")
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
136 testui(user='abc', group='def', tusers=['foo', 'xyz', 'abc', 'bleh'],
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
137 tgroups=['bar', 'baz', 'qux'])
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
138 # ... lists of group names work
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
139 print("# list of group names")
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
140 testui(user='abc', group='def', tusers=['foo', 'xyz', 'bleh'],
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
141 tgroups=['bar', 'def', 'baz', 'qux'])
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
142
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
143 print("# Can't figure out the name of the user running this process")
3551
3b07e223534b Only read .hg/hgrc files from trusted users/groups
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
144 testui(user='abc', group='def', cuser=None)
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
145
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
146 print("# prints debug warnings")
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
147 u = testui(user='abc', group='def', cuser='foo', debug=True)
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
148
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
149 print("# report_untrusted enabled without debug hides warnings")
13493
95b0d4c1c9e1 ui: always report untrusted hgrc files when debug enabled
Ry4an Brase <ry4an-hg@ry4an.org>
parents: 11291
diff changeset
150 u = testui(user='abc', group='def', cuser='foo', report=False)
95b0d4c1c9e1 ui: always report untrusted hgrc files when debug enabled
Ry4an Brase <ry4an-hg@ry4an.org>
parents: 11291
diff changeset
151
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
152 print("# report_untrusted enabled with debug shows warnings")
13493
95b0d4c1c9e1 ui: always report untrusted hgrc files when debug enabled
Ry4an Brase <ry4an-hg@ry4an.org>
parents: 11291
diff changeset
153 u = testui(user='abc', group='def', cuser='foo', debug=True, report=False)
95b0d4c1c9e1 ui: always report untrusted hgrc files when debug enabled
Ry4an Brase <ry4an-hg@ry4an.org>
parents: 11291
diff changeset
154
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
155 print("# ui.readconfig sections")
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
156 filename = 'foobar'
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
157 f = open(filename, 'w')
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
158 f.write('[foobar]\n')
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
159 f.write('baz = quux\n')
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
160 f.close()
19872
681f7b9213a4 check-code: check for spaces around = for named parameters
Mads Kiilerich <madski@unity3d.com>
parents: 13493
diff changeset
161 u.readconfig(filename, sections=['foobar'])
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
162 print(u.config('foobar', 'baz'))
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
163
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
164 print()
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
165 print("# read trusted, untrusted, new ui, trusted")
30559
d83ca854fa21 ui: factor out ui.load() to create a ui without loading configs (API)
Yuya Nishihara <yuya@tcha.org>
parents: 28934
diff changeset
166 u = uimod.ui.load()
34858
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
167 # disable the configuration registration warning
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
168 #
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
169 # the purpose of this test is to check the old behavior, not to validate the
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
170 # behavior from registered item. so we silent warning related to unregisted
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
171 # config.
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
172 u.setconfig('devel', 'warn-config-unknown', False, 'test')
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 31857
diff changeset
173 u.setconfig('devel', 'all-warnings', False, 'test')
8136
6b5522cb2ad2 ui: refactor option setting
Matt Mackall <mpm@selenic.com>
parents: 5523
diff changeset
174 u.setconfig('ui', 'debug', 'on')
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
175 u.readconfig(filename)
8190
9b8ac5fb7760 ui: kill most users of parentui name and arg, replace with .copy()
Matt Mackall <mpm@selenic.com>
parents: 8144
diff changeset
176 u2 = u.copy()
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
177 def username(uid=None):
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
178 return 'foo'
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
179 util.username = username
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
180 u2.readconfig('.hg/hgrc')
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
181 print('trusted:')
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
182 print(u2.config('foobar', 'baz'))
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
183 print('untrusted:')
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
184 print(u2.config('foobar', 'baz', untrusted=True))
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
185
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
186 print()
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
187 print("# error handling")
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
188
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25660
diff changeset
189 def assertraises(f, exc=error.Abort):
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
190 try:
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
191 f()
25660
328739ea70c3 global: mass rewrite to use modern exception syntax
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19872
diff changeset
192 except exc as inst:
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
193 print('raised', inst.__class__.__name__)
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
194 else:
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
195 print('no exception?!')
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
196
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
197 print("# file doesn't exist")
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
198 os.unlink('.hg/hgrc')
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
199 assert not os.path.exists('.hg/hgrc')
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
200 testui(debug=True, silent=True)
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
201 testui(user='abc', group='def', debug=True, silent=True)
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
202
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
203 print()
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
204 print("# parse error")
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
205 f = open('.hg/hgrc', 'w')
8144
fca54469480e ui: introduce new config parser
Matt Mackall <mpm@selenic.com>
parents: 8142
diff changeset
206 f.write('foo')
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
207 f.close()
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
208
8144
fca54469480e ui: introduce new config parser
Matt Mackall <mpm@selenic.com>
parents: 8142
diff changeset
209 try:
fca54469480e ui: introduce new config parser
Matt Mackall <mpm@selenic.com>
parents: 8142
diff changeset
210 testui(user='abc', group='def', silent=True)
25660
328739ea70c3 global: mass rewrite to use modern exception syntax
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19872
diff changeset
211 except error.ParseError as inst:
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
212 print(inst)
3552
9b52239dc740 save settings from untrusted config files in a separate configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3551
diff changeset
213
8144
fca54469480e ui: introduce new config parser
Matt Mackall <mpm@selenic.com>
parents: 8142
diff changeset
214 try:
fca54469480e ui: introduce new config parser
Matt Mackall <mpm@selenic.com>
parents: 8142
diff changeset
215 testui(debug=True, silent=True)
25660
328739ea70c3 global: mass rewrite to use modern exception syntax
Gregory Szorc <gregory.szorc@gmail.com>
parents: 19872
diff changeset
216 except error.ParseError as inst:
28934
c4040a35b5d9 tests: make test-trusted use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28913
diff changeset
217 print(inst)
31472
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
218
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
219 print()
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
220 print('# access typed information')
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
221 with open('.hg/hgrc', 'w') as f:
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
222 f.write('''\
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
223 [foo]
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
224 sub=main
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
225 sub:one=one
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
226 sub:two=two
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
227 path=monty/python
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
228 bool=true
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
229 int=42
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
230 bytes=81mb
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
231 list=spam,ham,eggs
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
232 ''')
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
233 u = testui(user='abc', group='def', cuser='foo', silent=True)
31857
08fbc97d1364 tests: print Unix style paths in *.py tests
Matt Harbison <matt_harbison@yahoo.com>
parents: 31472
diff changeset
234 def configpath(section, name, default=None, untrusted=False):
08fbc97d1364 tests: print Unix style paths in *.py tests
Matt Harbison <matt_harbison@yahoo.com>
parents: 31472
diff changeset
235 path = u.configpath(section, name, default, untrusted)
08fbc97d1364 tests: print Unix style paths in *.py tests
Matt Harbison <matt_harbison@yahoo.com>
parents: 31472
diff changeset
236 if path is None:
08fbc97d1364 tests: print Unix style paths in *.py tests
Matt Harbison <matt_harbison@yahoo.com>
parents: 31472
diff changeset
237 return None
08fbc97d1364 tests: print Unix style paths in *.py tests
Matt Harbison <matt_harbison@yahoo.com>
parents: 31472
diff changeset
238 return util.pconvert(path)
08fbc97d1364 tests: print Unix style paths in *.py tests
Matt Harbison <matt_harbison@yahoo.com>
parents: 31472
diff changeset
239
31472
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
240 print('# suboptions, trusted and untrusted')
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
241 trusted = u.configsuboptions('foo', 'sub')
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
242 untrusted = u.configsuboptions('foo', 'sub', untrusted=True)
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
243 print(
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
244 (trusted[0], sorted(trusted[1].items())),
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
245 (untrusted[0], sorted(untrusted[1].items())))
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
246 print('# path, trusted and untrusted')
31857
08fbc97d1364 tests: print Unix style paths in *.py tests
Matt Harbison <matt_harbison@yahoo.com>
parents: 31472
diff changeset
247 print(configpath('foo', 'path'), configpath('foo', 'path', untrusted=True))
31472
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
248 print('# bool, trusted and untrusted')
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
249 print(u.configbool('foo', 'bool'), u.configbool('foo', 'bool', untrusted=True))
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
250 print('# int, trusted and untrusted')
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
251 print(
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
252 u.configint('foo', 'int', 0),
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
253 u.configint('foo', 'int', 0, untrusted=True))
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
254 print('# bytes, trusted and untrusted')
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
255 print(
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
256 u.configbytes('foo', 'bytes', 0),
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
257 u.configbytes('foo', 'bytes', 0, untrusted=True))
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
258 print('# list, trusted and untrusted')
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
259 print(
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
260 u.configlist('foo', 'list', []),
75e4bae56068 config: honour the trusted flag in ui.configbytes
Martijn Pieters <mjpieters@fb.com>
parents: 30559
diff changeset
261 u.configlist('foo', 'list', [], untrusted=True))