def test_lslocks_and_rmlocks(sbox):
    "test 'svnadmin lslocks' and 'svnadmin rmlocks'"
    sbox.build(create_wc=False)
    iota_url = (sbox.repo_url + '/iota')
    lambda_url = (sbox.repo_url + '/A/B/lambda')
    (exit_code, output, errput) = svntest.main.run_svnadmin('lslocks', sbox.repo_dir)
    if (exit_code or errput or output):
        raise svntest.Failure("Error: 'lslocks' failed")
    expected_output = svntest.verify.UnorderedRegexListOutput(["'.*lambda' locked by user 'jrandom'.\n", "'.*iota' locked by user 'jrandom'.\n"])
    svntest.actions.run_and_verify_svn(expected_output, [], 'lock', '-m', 'Locking files', iota_url, lambda_url)

    def expected_output_list(path):
        return [('Path: ' + path), 'UUID Token: opaquelocktoken:.*', 'Owner: jrandom', 'Created:.*', 'Expires:.*', 'Comment \\(1 line\\):', 'Locking files', '\n']
    (exit_code, output, errput) = svntest.main.run_svnadmin('lslocks', sbox.repo_dir)
    if errput:
        raise SVNUnexpectedStderr(errput)
    svntest.verify.verify_exit_code(None, exit_code, 0)
    expected_output = svntest.verify.UnorderedRegexListOutput((expected_output_list('/A/B/lambda') + expected_output_list('/iota')))
    svntest.verify.compare_and_display_lines('lslocks output mismatch', 'output', expected_output, output)
    (exit_code, output, errput) = svntest.main.run_svnadmin('lslocks', sbox.repo_dir, 'A')
    if errput:
        raise SVNUnexpectedStderr(errput)
    expected_output = svntest.verify.RegexListOutput(expected_output_list('/A/B/lambda'))
    svntest.verify.compare_and_display_lines('lslocks output mismatch', 'output', expected_output, output)
    svntest.verify.verify_exit_code(None, exit_code, 0)
    (exit_code, output, errput) = svntest.main.run_svnadmin('rmlocks', sbox.repo_dir, 'iota', 'A/B/lambda')
    expected_output = UnorderedOutput(["Removed lock on '/iota'.\n", "Removed lock on '/A/B/lambda'.\n"])
    svntest.verify.verify_outputs("Unexpected output while running 'svnadmin rmlocks'.", output, [], expected_output, None)
test 'svnadmin lslocks' and 'svnadmin rmlocks'
def test_lslocks_and_rmlocks(sbox):
    
    sbox.build(create_wc=False)
    iota_url = (sbox.repo_url + '/iota')
    lambda_url = (sbox.repo_url + '/A/B/lambda')
    (exit_code, output, errput) = svntest.main.run_svnadmin('lslocks', sbox.repo_dir)
    if (exit_code or errput or output):
        raise svntest.Failure("Error: 'lslocks' failed")
    expected_output = svntest.verify.UnorderedRegexListOutput(["'.*lambda' locked by user 'jrandom'.\n", "'.*iota' locked by user 'jrandom'.\n"])
    svntest.actions.run_and_verify_svn(expected_output, [], 'lock', '-m', 'Locking files', iota_url, lambda_url)

    def expected_output_list(path):
        return [('Path: ' + path), 'UUID Token: opaquelocktoken:.*', 'Owner: jrandom', 'Created:.*', 'Expires:.*', 'Comment \\(1 line\\):', 'Locking files', '\n']
    (exit_code, output, errput) = svntest.main.run_svnadmin('lslocks', sbox.repo_dir)
    if errput:
        raise SVNUnexpectedStderr(errput)
    svntest.verify.verify_exit_code(None, exit_code, 0)
    expected_output = svntest.verify.UnorderedRegexListOutput((expected_output_list('/A/B/lambda') + expected_output_list('/iota')))
    svntest.verify.compare_and_display_lines('lslocks output mismatch', 'output', expected_output, output)
    (exit_code, output, errput) = svntest.main.run_svnadmin('lslocks', sbox.repo_dir, 'A')
    if errput:
        raise SVNUnexpectedStderr(errput)
    expected_output = svntest.verify.RegexListOutput(expected_output_list('/A/B/lambda'))
    svntest.verify.compare_and_display_lines('lslocks output mismatch', 'output', expected_output, output)
    svntest.verify.verify_exit_code(None, exit_code, 0)
    (exit_code, output, errput) = svntest.main.run_svnadmin('rmlocks', sbox.repo_dir, 'iota', 'A/B/lambda')
    expected_output = UnorderedOutput(["Removed lock on '/iota'.\n", "Removed lock on '/A/B/lambda'.\n"])
    svntest.verify.verify_outputs("Unexpected output while running 'svnadmin rmlocks'.", output, [], expected_output, None)