本文整理汇总了Python中svntest.main.write_authz_file函数的典型用法代码示例。如果您正苦于以下问题:Python write_authz_file函数的具体用法?Python write_authz_file怎么用?Python write_authz_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_authz_file函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: authz_partial_export_test
def authz_partial_export_test(sbox):
"test authz for export with unreadable subfolder"
sbox.build(create_wc = False, read_only = True)
local_dir = sbox.wc_dir
# cleanup remains of a previous test run.
svntest.main.safe_rmtree(local_dir)
write_restrictive_svnserve_conf(sbox.repo_dir)
# 1st part: disable read access on folder A/B, export should not
# download this folder
# write an authz file with *= on /A/B
write_authz_file(sbox, { "/": "* = r", "/A/B": "* =" })
# export a working copy, should not dl /A/B
expected_output = svntest.main.greek_state.copy()
expected_output.wc_dir = local_dir
expected_output.desc[''] = Item()
expected_output.tweak(status='A ', contents=None)
expected_output.remove('A/B', 'A/B/lambda', 'A/B/E', 'A/B/E/alpha',
'A/B/E/beta', 'A/B/F')
expected_wc = svntest.main.greek_state.copy()
expected_wc.remove('A/B', 'A/B/lambda', 'A/B/E', 'A/B/E/alpha',
'A/B/E/beta', 'A/B/F')
svntest.actions.run_and_verify_export(sbox.repo_url, local_dir,
expected_output,
expected_wc)
开发者ID:fredjean,项目名称:svnkit,代码行数:32,代码来源:authz_tests.py
示例2: authz_open_root
def authz_open_root(sbox):
"authz issue #2486 - open root"
sbox.build()
write_authz_file(sbox, {"/": "", "/A": "jrandom = rw"})
write_restrictive_svnserve_conf(sbox.repo_dir)
# we have write access in folder /A, but not in root. Test on too
# restrictive access needed in open_root by modifying a file in /A
wc_dir = sbox.wc_dir
mu_path = os.path.join(wc_dir, 'A', 'mu')
svntest.main.file_append(mu_path, "hi")
# Create expected output tree.
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(verb='Sending'),
})
# Commit the one file.
svntest.actions.run_and_verify_commit(wc_dir,
expected_output,
None,
None,
mu_path)
开发者ID:fredjean,项目名称:svnkit,代码行数:27,代码来源:authz_tests.py
示例3: authz_open_directory
def authz_open_directory(sbox):
"authz issue #2486 - open directory"
sbox.build()
write_authz_file(sbox, {"/": "*=rw", "/A/B": "*=", "/A/B/E": "jrandom = rw"})
write_restrictive_svnserve_conf(sbox.repo_dir)
# we have write access in folder /A/B/E, but not in /A/B. Test on too
# restrictive access needed in open_directory by moving file /A/mu to
# /A/B/E
wc_dir = sbox.wc_dir
mu_path = os.path.join(wc_dir, 'A', 'mu')
E_path = os.path.join(wc_dir, 'A', 'B', 'E')
svntest.main.run_svn(None, 'mv', mu_path, E_path)
# Create expected output tree.
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(verb='Deleting'),
'A/B/E/mu' : Item(verb='Adding'),
})
# Commit the working copy.
svntest.actions.run_and_verify_commit(wc_dir,
expected_output,
None,
None,
wc_dir)
开发者ID:fredjean,项目名称:svnkit,代码行数:31,代码来源:authz_tests.py
示例4: copy_delete_unreadable_child
def copy_delete_unreadable_child(sbox):
"copy, then rm at-src-unreadable child"
# Prepare the source: Greek tree (r1), cp+rm (r2).
sbox.build(create_wc = False)
svntest.actions.run_and_verify_svnmucc(None, [],
'-m', 'r2',
'-U', sbox.repo_url,
'cp', 'HEAD', '/', 'branch',
'rm', 'branch/A')
# Create the destination.
dest_sbox = sbox.clone_dependent()
dest_sbox.build(create_wc=False, empty=True)
svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
# Lock down the source.
write_restrictive_svnserve_conf(sbox.repo_dir, anon_access='read')
src_authz = sbox.authz_name()
write_authz_file(sbox, None,
prefixed_rules = {
src_authz + ':/': '* = r',
src_authz + ':/A': '* =',
})
dest_url = dest_sbox.file_protocol_repo_url()
run_init(dest_url, sbox.repo_url)
run_sync(dest_url)
# sanity check
svntest.actions.run_and_verify_svn(["iota\n"], [],
'ls', dest_url+'/[email protected]')
开发者ID:svn2github,项目名称:subversion,代码行数:32,代码来源:svnsync_authz_tests.py
示例5: basic_authz
def basic_authz(sbox):
"verify that unreadable content is not synced"
sbox.build(create_wc=False)
write_restrictive_svnserve_conf(sbox.repo_dir)
dest_sbox = sbox.clone_dependent()
dest_sbox.build(create_wc=False, empty=True)
svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
run_init(dest_sbox.repo_url, sbox.repo_url)
src_authz = sbox.authz_name()
dst_authz = dest_sbox.authz_name()
write_authz_file(
sbox, None, prefixed_rules={src_authz + ":/": "* = r", src_authz + ":/A/B": "* =", dst_authz + ":/": "* = rw"}
)
run_sync(dest_sbox.repo_url)
lambda_url = dest_sbox.repo_url + "/A/B/lambda"
iota_url = dest_sbox.repo_url + "/iota"
# this file should have been blocked by authz
svntest.actions.run_and_verify_svn([], svntest.verify.AnyOutput, "cat", lambda_url)
# this file should have been synced
svntest.actions.run_and_verify_svn(svntest.verify.AnyOutput, [], "cat", iota_url)
开发者ID:sajeruk,项目名称:svn_diff,代码行数:29,代码来源:svnsync_authz_tests.py
示例6: copy_delete_unreadable_child
def copy_delete_unreadable_child(sbox):
"copy, then rm at-src-unreadable child"
# Prepare the source: Greek tree (r1), cp+rm (r2).
sbox.build(create_wc=False)
svntest.actions.run_and_verify_svnmucc(
None, [], "-m", "r2", "-U", sbox.repo_url, "cp", "HEAD", "/", "branch", "rm", "branch/A"
)
# Create the destination.
dest_sbox = sbox.clone_dependent()
dest_sbox.build(create_wc=False, empty=True)
svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
# Lock down the source.
write_restrictive_svnserve_conf(sbox.repo_dir, anon_access="read")
src_authz = sbox.authz_name()
write_authz_file(sbox, None, prefixed_rules={src_authz + ":/": "* = r", src_authz + ":/A": "* ="})
dest_url = dest_sbox.file_protocol_repo_url()
run_init(dest_url, sbox.repo_url)
run_sync(dest_url)
# sanity check
svntest.actions.run_and_verify_svn(["iota\n"], [], "ls", dest_url + "/[email protected]")
开发者ID:sajeruk,项目名称:svn_diff,代码行数:25,代码来源:svnsync_authz_tests.py
示例7: authz_aliases
def authz_aliases(sbox):
"test authz for aliases"
sbox.build(create_wc = False)
write_restrictive_svnserve_conf(sbox.repo_dir)
if sbox.repo_url.startswith("http"):
expected_err = ".*403 Forbidden.*"
else:
expected_err = ".*svn: Authorization failed.*"
write_authz_file(sbox, { "/" : "* = r",
"/A/B" : "&jray = rw" },
{ "aliases" : 'jray = jrandom' } )
root_url = sbox.repo_url
A_url = root_url + '/A'
B_url = A_url + '/B'
iota_url = root_url + '/iota'
# copy a remote file, target is readonly for jconstant: should fail
svntest.actions.run_and_verify_svn(None,
None, expected_err,
'cp',
'--username', svntest.main.wc_author2,
'-m', 'logmsg',
iota_url, B_url)
# try the same action, but as user jray (alias of jrandom), should work.
svntest.actions.run_and_verify_svn(None,
None, [],
'cp',
'-m', 'logmsg',
iota_url, B_url)
开发者ID:fredjean,项目名称:svnkit,代码行数:35,代码来源:authz_tests.py
示例8: copy_from_unreadable_dir
def copy_from_unreadable_dir(sbox):
"verify that copies from unreadable dirs work"
sbox.build()
B_url = sbox.repo_url + "/A/B"
P_url = sbox.repo_url + "/A/P"
# Set a property on the directory we're going to copy, and a file in it, to
# confirm that they're transmitted when we later sync the copied directory
svntest.actions.run_and_verify_svn(None, [], "pset", "foo", "bar", sbox.wc_dir + "/A/B/lambda")
svntest.actions.run_and_verify_svn(None, [], "pset", "baz", "zot", sbox.wc_dir + "/A/B")
svntest.actions.run_and_verify_svn(None, [], "ci", sbox.wc_dir + "/A/B", "-m", "log_msg")
# Now copy that directory so we'll see it in our synced copy
svntest.actions.run_and_verify_svn(None, [], "cp", B_url, P_url, "-m", "Copy B to P")
write_restrictive_svnserve_conf(sbox.repo_dir)
dest_sbox = sbox.clone_dependent()
dest_sbox.build(create_wc=False, empty=True)
svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
src_authz = sbox.authz_name()
dst_authz = dest_sbox.authz_name()
write_authz_file(
sbox, None, prefixed_rules={src_authz + ":/": "* = r", src_authz + ":/A/B": "* =", dst_authz + ":/": "* = rw"}
)
run_init(dest_sbox.repo_url, sbox.repo_url)
run_sync(dest_sbox.repo_url)
expected_out = [
"Changed paths:\n",
" A /A/P\n",
" A /A/P/E\n",
" A /A/P/E/alpha\n",
" A /A/P/E/beta\n",
" A /A/P/F\n",
" A /A/P/lambda\n",
"\n",
"\n", # log message is stripped
]
exit_code, out, err = svntest.main.run_svn(None, "log", "-r", "3", "-v", dest_sbox.repo_url)
if err:
raise SVNUnexpectedStderr(err)
svntest.verify.compare_and_display_lines(None, "LOG", expected_out, out[2:11])
svntest.actions.run_and_verify_svn(["bar\n"], [], "pget", "foo", dest_sbox.repo_url + "/A/P/lambda")
svntest.actions.run_and_verify_svn(["zot\n"], [], "pget", "baz", dest_sbox.repo_url + "/A/P")
开发者ID:sajeruk,项目名称:svn_diff,代码行数:58,代码来源:svnsync_authz_tests.py
示例9: authz_checkout_and_update_test
def authz_checkout_and_update_test(sbox):
"test authz for checkout and update"
sbox.build(create_wc = False, read_only = True)
local_dir = sbox.wc_dir
write_restrictive_svnserve_conf(sbox.repo_dir)
# 1st part: disable read access on folder A/B, checkout should not
# download this folder
# write an authz file with *= on /A/B
write_authz_file(sbox, { "/": "* = r",
"/A/B": "* ="})
# checkout a working copy, should not dl /A/B
expected_output = svntest.main.greek_state.copy()
expected_output.wc_dir = local_dir
expected_output.tweak(status='A ', contents=None)
expected_output.remove('A/B', 'A/B/lambda', 'A/B/E', 'A/B/E/alpha',
'A/B/E/beta', 'A/B/F')
expected_wc = svntest.main.greek_state.copy()
expected_wc.remove('A/B', 'A/B/lambda', 'A/B/E', 'A/B/E/alpha',
'A/B/E/beta', 'A/B/F')
svntest.actions.run_and_verify_checkout(sbox.repo_url, local_dir,
expected_output,
expected_wc)
# 2nd part: now enable read access
# write an authz file with *=r on /
write_authz_file(sbox, { "/": "* = r"})
# update the working copy, should download /A/B because we now have read
# access
expected_output = svntest.wc.State(local_dir, {
'A/B' : Item(status='A '),
'A/B/lambda' : Item(status='A '),
'A/B/E' : Item(status='A '),
'A/B/E/alpha' : Item(status='A '),
'A/B/E/beta' : Item(status='A '),
'A/B/F' : Item(status='A '),
})
expected_wc = svntest.main.greek_state
expected_status = svntest.actions.get_virginal_state(local_dir, 1)
svntest.actions.run_and_verify_update(local_dir,
expected_output,
expected_wc,
expected_status,
None,
None, None,
None, None, 1)
开发者ID:fredjean,项目名称:svnkit,代码行数:56,代码来源:authz_tests.py
示例10: authz_locking
def authz_locking(sbox):
"test authz for locking"
sbox.build()
write_authz_file(sbox, {"/": "", "/A": "jrandom = rw"})
write_restrictive_svnserve_conf(sbox.repo_dir)
if sbox.repo_url.startswith('http'):
expected_err = ".*403 Forbidden.*"
else:
expected_err = ".*svn: Authorization failed.*"
root_url = sbox.repo_url
wc_dir = sbox.wc_dir
iota_url = root_url + '/iota'
iota_path = os.path.join(wc_dir, 'iota')
A_url = root_url + '/A'
mu_path = os.path.join(wc_dir, 'A', 'mu')
# lock a file url, target is readonly: should fail
svntest.actions.run_and_verify_svn(None,
None, expected_err,
'lock',
'-m', 'lock msg',
iota_url)
# lock a file path, target is readonly: should fail
svntest.actions.run_and_verify_svn(None,
None, expected_err,
'lock',
'-m', 'lock msg',
iota_path)
# Test for issue 2700: we have write access in folder /A, but not in root.
# Get a lock on /A/mu and try to commit it.
# lock a file path, target is writeable: should succeed
svntest.actions.run_and_verify_svn(None,
None, [],
'lock',
'-m', 'lock msg',
mu_path)
svntest.main.file_append(mu_path, "hi")
expected_output = svntest.wc.State(wc_dir, {
'A/mu' : Item(verb='Sending'),
})
svntest.actions.run_and_verify_commit(wc_dir,
expected_output,
[],
None,
mu_path)
开发者ID:fredjean,项目名称:svnkit,代码行数:55,代码来源:authz_tests.py
示例11: copy_with_mod_from_unreadable_dir_and_copy
def copy_with_mod_from_unreadable_dir_and_copy(sbox):
"verify copies with mods from unreadable dirs +copy"
sbox.build()
# Make a copy of the B directory.
svntest.actions.run_and_verify_svn(None, [], "cp", sbox.wc_dir + "/A/B", sbox.wc_dir + "/A/P")
# Copy a (readable) file into the copied directory.
svntest.actions.run_and_verify_svn(None, [], "cp", sbox.wc_dir + "/A/D/gamma", sbox.wc_dir + "/A/P/E")
# Commit the copy-with-modification.
svntest.actions.run_and_verify_svn(None, [], "ci", sbox.wc_dir, "-m", "log_msg")
# Lock down the source repository.
write_restrictive_svnserve_conf(sbox.repo_dir)
dest_sbox = sbox.clone_dependent()
dest_sbox.build(create_wc=False, empty=True)
svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
src_authz = sbox.authz_name()
dst_authz = dest_sbox.authz_name()
write_authz_file(
sbox, None, prefixed_rules={src_authz + ":/": "* = r", src_authz + ":/A/B": "* =", dst_authz + ":/": "* = rw"}
)
run_init(dest_sbox.repo_url, sbox.repo_url)
run_sync(dest_sbox.repo_url)
expected_out = [
"Changed paths:\n",
" A /A/P\n",
" A /A/P/E\n",
" A /A/P/E/alpha\n",
" A /A/P/E/beta\n",
" A /A/P/E/gamma (from /A/D/gamma:1)\n",
" A /A/P/F\n",
" A /A/P/lambda\n",
"\n",
"\n", # log message is stripped
]
exit_code, out, err = svntest.main.run_svn(None, "log", "-r", "2", "-v", dest_sbox.repo_url)
if err:
raise SVNUnexpectedStderr(err)
svntest.verify.compare_and_display_lines(None, "LOG", expected_out, out[2:12])
开发者ID:sajeruk,项目名称:svn_diff,代码行数:51,代码来源:svnsync_authz_tests.py
示例12: specific_deny_authz
def specific_deny_authz(sbox):
"verify if specifically denied paths dont sync"
sbox.build()
dest_sbox = sbox.clone_dependent()
dest_sbox.build(create_wc=False, empty=True)
svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
run_init(dest_sbox.repo_url, sbox.repo_url)
svntest.main.run_svn(None, "cp",
os.path.join(sbox.wc_dir, "A"),
os.path.join(sbox.wc_dir, "A_COPY")
)
svntest.main.run_svn(None, "ci", "-mm", sbox.wc_dir)
write_restrictive_svnserve_conf(sbox.repo_dir)
# For mod_dav_svn's parent path setup we need per-repos permissions in
# the authz file...
if svntest.main.is_ra_type_dav():
src_authz = sbox.authz_name()
dst_authz = dest_sbox.authz_name()
write_authz_file(sbox, None,
prefixed_rules = {
src_authz + ':/': '* = r',
src_authz + ':/A': '* =',
src_authz + ':/A_COPY/B/lambda': '* =',
dst_authz + ':/': '* = rw',
})
# Otherwise we can just go with the permissions needed for the source
# repository.
else:
write_authz_file(sbox, None,
prefixed_rules = {
'/': '* = r',
'/A': '* =',
'/A_COPY/B/lambda': '* =',
})
run_sync(dest_sbox.repo_url)
lambda_url = dest_sbox.repo_url + '/A_COPY/B/lambda'
# this file should have been blocked by authz
svntest.actions.run_and_verify_svn([], svntest.verify.AnyOutput,
'cat',
lambda_url)
开发者ID:svn2github,项目名称:subversion,代码行数:50,代码来源:svnsync_authz_tests.py
示例13: authz_switch_to_directory
def authz_switch_to_directory(sbox):
"switched to directory, no read access on parents"
sbox.build(read_only = True)
write_authz_file(sbox, {"/": "*=rw", "/A/B": "*=", "/A/B/E": "jrandom = rw"})
write_restrictive_svnserve_conf(sbox.repo_dir)
wc_dir = sbox.wc_dir
mu_path = os.path.join(wc_dir, 'A', 'mu')
F_path = os.path.join(wc_dir, 'A', 'B', 'F')
G_path = os.path.join(wc_dir, 'A', 'D', 'G')
# Switch /A/B/E to /A/B/F.
svntest.main.run_svn(None, 'switch', sbox.repo_url + "/A/B/E", G_path)
开发者ID:fredjean,项目名称:svnkit,代码行数:16,代码来源:authz_tests.py
示例14: broken_authz_file
def broken_authz_file(sbox):
"broken authz files cause errors"
sbox.build(create_wc = False)
# No characters but 'r', 'w', and whitespace are allowed as a value
# in an authz rule.
write_authz_file(sbox, {"/": "jrandom = rw # End-line comments disallowed"})
write_restrictive_svnserve_conf(sbox.repo_dir)
out, err = svntest.main.run_svn(1,
"delete",
sbox.repo_url + "/A",
"-m", "a log message");
if out:
raise svntest.verify.SVNUnexpectedStdout(out)
if not err:
raise svntest.verify.SVNUnexpectedStderr("Missing stderr")
开发者ID:fredjean,项目名称:svnkit,代码行数:19,代码来源:authz_tests.py
示例15: authz_validate
def authz_validate(sbox):
"test the authz validation rules"
sbox.build(create_wc = False, read_only = True)
write_restrictive_svnserve_conf(sbox.repo_dir)
A_url = sbox.repo_url + '/A'
# If any of the validate rules fail, the authz isn't loaded so there's no
# access at all to the repository.
# Test 1: Undefined group
write_authz_file(sbox, { "/" : "* = r",
"/A/B" : "@undefined_group = rw" })
if sbox.repo_url.startswith("http"):
expected_err = ".*403 Forbidden.*"
else:
expected_err = ".*@undefined_group.*"
# validation of this authz file should fail, so no repo access
svntest.actions.run_and_verify_svn("ls remote folder",
None, expected_err,
'ls',
A_url)
# Test 2: Circular dependency
write_authz_file(sbox, { "/" : "* = r" },
{ "groups" : """admins = admin1, admin2, @devs
devs1 = @admins, dev1
devs2 = @admins, dev2
devs = @devs1, dev3, dev4""" })
if sbox.repo_url.startswith("http"):
expected_err = ".*403 Forbidden.*"
else:
expected_err = ".*Circular dependency.*"
# validation of this authz file should fail, so no repo access
svntest.actions.run_and_verify_svn("ls remote folder",
None, expected_err,
'ls',
A_url)
# Test 3: Group including other group 2 times (issue 2684)
write_authz_file(sbox, { "/" : "* = r" },
{ "groups" : """admins = admin1, admin2
devs1 = @admins, dev1
devs2 = @admins, dev2
users = @devs1, @devs2, user1, user2""" })
# validation of this authz file should fail, so no repo access
svntest.actions.run_and_verify_svn("ls remote folder",
['B/\n', 'C/\n', 'D/\n', 'mu\n'],
[],
'ls',
A_url)
开发者ID:fredjean,项目名称:svnkit,代码行数:58,代码来源:authz_tests.py
示例16: authz_checkout_test
def authz_checkout_test(sbox):
"test authz for checkout"
sbox.build(create_wc = False, read_only = True)
local_dir = sbox.wc_dir
write_restrictive_svnserve_conf(sbox.repo_dir)
# 1st part: disable all read access, checkout should fail
# write an authz file with *= on /
if sbox.repo_url.startswith('http'):
expected_err = ".*403 Forbidden.*"
else:
expected_err = ".*svn: Authorization failed.*"
write_authz_file(sbox, { "/": "* ="})
# checkout a working copy, should fail
svntest.actions.run_and_verify_svn(None, None, expected_err,
'co', sbox.repo_url, local_dir)
# 2nd part: now enable read access
write_authz_file(sbox, { "/": "* = r"})
# checkout a working copy, should succeed because we have read access
expected_output = svntest.main.greek_state.copy()
expected_output.wc_dir = local_dir
expected_output.tweak(status='A ', contents=None)
expected_wc = svntest.main.greek_state
svntest.actions.run_and_verify_checkout(sbox.repo_url,
local_dir,
expected_output,
expected_wc)
开发者ID:fredjean,项目名称:svnkit,代码行数:37,代码来源:authz_tests.py
示例17: authz_access_required_at_repo_root2
def authz_access_required_at_repo_root2(sbox):
"more authz issue #3242 - update to renamed file"
sbox.build(create_wc = False)
root_url = sbox.repo_url
# Now we get all restrictive.
write_authz_file(sbox, {'/': '* =',
'/A': 'jrandom = rw'})
write_restrictive_svnserve_conf(sbox.repo_dir)
# Rename a file.
svntest.main.run_svn(None, 'mv',
'-m', 'rename file in readable writable space',
root_url + '/A/B/E/alpha',
root_url + '/A/B/E/alpha-renamed')
# Check out original greek sub tree below /A/B/E
# and update it to the above rename.
wc_dir = sbox.add_wc_path('ABE')
os.mkdir(wc_dir)
svntest.main.run_svn(None, 'co', '-r', '1', root_url + '/A/B/E', wc_dir)
svntest.main.run_svn(None, 'up', wc_dir)
# Rename a directory.
svntest.main.run_svn(None, 'mv',
'-m', 'rename diretory in readable writable space',
root_url + '/A/D/H',
root_url + '/A/D/a g e')
# Check out original greek sub tree below /A/D
# and update it to the above rename.
wc_dir = sbox.add_wc_path('AD')
os.mkdir(wc_dir)
svntest.main.run_svn(None, 'co', '-r', '1', root_url + '/A/D', wc_dir)
svntest.main.run_svn(None, 'up', wc_dir)
开发者ID:matthewdpklanier,项目名称:alien-svn,代码行数:36,代码来源:authz_tests.py
示例18: merge_fails_if_subtree_is_deleted_on_src
def merge_fails_if_subtree_is_deleted_on_src(sbox):
"merge fails if subtree is deleted on src"
## See http://subversion.tigris.org/issues/show_bug.cgi?id=2876. ##
# Create a WC
sbox.build()
wc_dir = sbox.wc_dir
if is_ra_type_svn() or is_ra_type_dav():
write_authz_file(sbox, {"/" : "* = rw",
"/unrelated" : ("* =\n" +
svntest.main.wc_author2 + " = rw")})
# Some paths we'll care about
Acopy_path = sbox.ospath('A_copy')
gamma_path = sbox.ospath('A/D/gamma')
Acopy_gamma_path = sbox.ospath('A_copy/D/gamma')
Acopy_D_path = sbox.ospath('A_copy/D')
A_url = sbox.repo_url + '/A'
Acopy_url = sbox.repo_url + '/A_copy'
# Contents to be added to 'gamma'
new_content = "line1\nline2\nline3\nline4\nline5\n"
svntest.main.file_write(gamma_path, new_content)
# Create expected output tree for commit
expected_output = wc.State(wc_dir, {
'A/D/gamma' : Item(verb='Sending'),
})
# Create expected status tree for commit
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.tweak('A/D/gamma', wc_rev=2)
# Commit the new content
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
svntest.actions.run_and_verify_svn(None, None, [], 'cp', A_url, Acopy_url,
'-m', 'create a new copy of A')
# Update working copy
svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)
svntest.main.file_substitute(gamma_path, "line1", "this is line1")
# Create expected output tree for commit
expected_output = wc.State(wc_dir, {
'A/D/gamma' : Item(verb='Sending'),
})
# Create expected status tree for commit
expected_status.tweak(wc_rev=3)
expected_status.tweak('A/D/gamma', wc_rev=4)
expected_status.add({
'A_copy' : Item(status=' ', wc_rev=3),
'A_copy/B' : Item(status=' ', wc_rev=3),
'A_copy/B/lambda' : Item(status=' ', wc_rev=3),
'A_copy/B/E' : Item(status=' ', wc_rev=3),
'A_copy/B/E/alpha': Item(status=' ', wc_rev=3),
'A_copy/B/E/beta' : Item(status=' ', wc_rev=3),
'A_copy/B/F' : Item(status=' ', wc_rev=3),
'A_copy/mu' : Item(status=' ', wc_rev=3),
'A_copy/C' : Item(status=' ', wc_rev=3),
'A_copy/D' : Item(status=' ', wc_rev=3),
'A_copy/D/gamma' : Item(status=' ', wc_rev=3),
'A_copy/D/G' : Item(status=' ', wc_rev=3),
'A_copy/D/G/pi' : Item(status=' ', wc_rev=3),
'A_copy/D/G/rho' : Item(status=' ', wc_rev=3),
'A_copy/D/G/tau' : Item(status=' ', wc_rev=3),
'A_copy/D/H' : Item(status=' ', wc_rev=3),
'A_copy/D/H/chi' : Item(status=' ', wc_rev=3),
'A_copy/D/H/omega': Item(status=' ', wc_rev=3),
'A_copy/D/H/psi' : Item(status=' ', wc_rev=3),
})
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
expected_status, None, wc_dir)
# Delete A/D/gamma from working copy
svntest.actions.run_and_verify_svn(None, None, [], 'delete', gamma_path)
# Create expected output tree for commit
expected_output = wc.State(wc_dir, {
'A/D/gamma' : Item(verb='Deleting'),
})
expected_status.remove('A/D/gamma')
svntest.actions.run_and_verify_commit(wc_dir,
expected_output,
expected_status,
None,
wc_dir, wc_dir)
svntest.actions.run_and_verify_svn(
None,
expected_merge_output([[3,4]],
['U ' + Acopy_gamma_path + '\n',
' U ' + Acopy_gamma_path + '\n']),
[], 'merge', '-r1:4',
#.........这里部分代码省略.........
开发者ID:Ranga123,项目名称:test1,代码行数:101,代码来源:merge_authz_tests.py
示例19: copy_from_unreadable_dir
def copy_from_unreadable_dir(sbox):
"verify that copies from unreadable dirs work"
sbox.build()
B_url = sbox.repo_url + '/A/B'
P_url = sbox.repo_url + '/A/P'
# Set a property on the directory we're going to copy, and a file in it, to
# confirm that they're transmitted when we later sync the copied directory
svntest.actions.run_and_verify_svn(None,
[],
'pset',
'foo',
'bar',
sbox.wc_dir + '/A/B/lambda')
svntest.actions.run_and_verify_svn(None,
[],
'pset',
'baz',
'zot',
sbox.wc_dir + '/A/B')
svntest.actions.run_and_verify_svn(None,
[],
'ci',
sbox.wc_dir + '/A/B',
'-m', 'log_msg')
# Now copy that directory so we'll see it in our synced copy
svntest.actions.run_and_verify_svn(None,
[],
'cp',
B_url,
P_url,
'-m', 'Copy B to P')
write_restrictive_svnserve_conf(sbox.repo_dir)
dest_sbox = sbox.clone_dependent()
dest_sbox.build(create_wc=False, empty=True)
svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
src_authz = sbox.authz_name()
dst_authz = dest_sbox.authz_name()
write_authz_file(sbox, None,
prefixed_rules = {
src_authz + ':/': '* = r',
src_authz + ':/A/B': '* =',
dst_authz + ':/': '* = rw',
})
run_init(dest_sbox.repo_url, sbox.repo_url)
run_sync(dest_sbox.repo_url)
expected_out = [
'Changed paths:\n',
' A /A/P\n',
' A /A/P/E\n',
' A /A/P/E/alpha\n',
' A /A/P/E/beta\n',
' A /A/P/F\n',
' A /A/P/lambda\n',
'\n',
'\n', # log message is stripped
]
exit_code, out, err = svntest.main.run_svn(None,
'log',
'-r', '3',
'-v',
dest_sbox.repo_url)
if err:
raise SVNUnexpectedStderr(err)
svntest.verify.compare_and_display_lines(None,
'LOG',
expected_out,
out[2:11])
svntest.actions.run_and_verify_svn(['bar\n'],
[],
'pget',
'foo',
dest_sbox.repo_url + '/A/P/lambda')
svntest.actions.run_and_verify_svn(['zot\n'],
[],
'pget',
'baz',
dest_sbox.repo_url + '/A/P')
开发者ID:svn2github,项目名称:subversion,代码行数:95,代码来源:svnsync_authz_tests.py
示例20: authz_read_access
def authz_read_access(sbox):
"test authz for read operations"
sbox.build(create_wc = False)
root_url = sbox.repo_url
A_url = root_url + '/A'
B_url = A_url + '/B'
C_url = A_url + '/C'
E_url = B_url + '/E'
mu_url = A_url + '/mu'
iota_url = root_url + '/iota'
lambda_url = B_url + '/lambda'
alpha_url = E_url + '/alpha'
D_url = A_url + '/D'
G_url = D_url + '/G'
pi_url = G_url + '/pi'
H_url = D_url + '/H'
chi_url = H_url + '/chi'
if sbox.repo_url.startswith("http"):
expected_err = ".*403 Forbidden.*"
else:
expected_err = ".*svn: Authorization failed.*"
# create some folders with spaces in their names
svntest.actions.run_and_verify_svn(None, None, [],
'mkdir',
'-m', 'logmsg',
B_url+'/folder with spaces',
B_url+'/folder with spaces/empty folder')
write_restrictive_svnserve_conf(sbox.repo_dir)
write_authz_file(sbox, { "/": "* = r",
"/A/B": "* =",
"/A/D": "* = rw",
"/A/D/G": ("* = rw\n" +
svntest.main.wc_author + " ="),
"/A/D/H": ("* = \n" +
svntest.main.wc_author + " = rw"),
"/A/B/folder with spaces":
(svntest.main.wc_author + " = r")})
# read a remote file
svntest.actions.run_and_verify_svn(None, ["This is the file 'iota'.\n"],
[], 'cat',
iota_url)
# read a remote file, readably by user specific exception
svntest.actions.run_and_verify_svn(None, ["This is the file 'chi'.\n"],
[], 'cat',
chi_url)
# read a remote file, unreadable: should fail
svntest.actions.run_and_verify_svn(None,
None, expected_err,
'cat',
lambda_url)
# read a remote file, unreadable through recursion: should fail
svntest.actions.run_and_verify_svn(None,
None, expected_err,
'cat',
alpha_url)
# read a remote file, user specific authorization is ignored because * = rw
svntest.actions.run_and_verify_svn(None, ["This is the file 'pi'.\n"],
[], 'cat',
pi_url)
# open a remote folder(ls)
svntest.actions.run_and_verify_svn("ls remote root folder",
["A/\n", "iota\n"],
[], 'ls',
root_url)
# open a remote folder(ls), unreadable: should fail
svntest.actions.run_and_verify_svn(None,
None, svntest.verify.AnyOutput, 'ls',
B_url)
# open a remote folder(ls) with spaces, should succeed
svntest.actions.run_and_verify_svn(None,
None, [], 'ls',
B_url+'/folder with spaces/empty folder')
# open a remote folder(ls), unreadable through recursion: should fail
svntest.actions.run_and_verify_svn(None,
None, expected_err,
'ls',
E_url)
# copy a remote file
svntest.actions.run_and_verify_svn(None, None, [], 'cp',
iota_url, D_url,
'-m', 'logmsg')
# copy a remote file, source is unreadable: should fail
svntest.actions.run_and_verify_svn(None,
None, expected_err,
#.........这里部分代码省略.........
开发者ID:fredjean,项目名称:svnkit,代码行数:101,代码来源:authz_tests.py
注:本文中的svntest.main.write_authz_file函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应 |
请发表评论