~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/tests/cmdline/info_tests.py

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
    svntest.actions.run_and_verify_info([expected_info], path)
181
181
 
182
182
    # check XML info
183
 
    exit_code, output, error = svntest.actions.run_and_verify_svn(None, None,
 
183
    exit_code, output, error = svntest.actions.run_and_verify_svn(None,
184
184
                                                                  [], 'info',
185
185
                                                                  path,
186
186
                                                                  '--xml')
208
208
def info_on_added_file(sbox):
209
209
  """info on added file"""
210
210
 
211
 
  svntest.actions.make_repo_and_wc(sbox)
 
211
  sbox.build()
212
212
  wc_dir = sbox.wc_dir
213
213
 
214
214
  # create new file
233
233
  svntest.actions.run_and_verify_info([expected], new_file)
234
234
 
235
235
  # check XML info
236
 
  exit_code, output, error = svntest.actions.run_and_verify_svn(None, None,
 
236
  exit_code, output, error = svntest.actions.run_and_verify_svn(None,
237
237
                                                                [], 'info',
238
238
                                                                new_file,
239
239
                                                                '--xml')
251
251
 
252
252
def info_on_mkdir(sbox):
253
253
  """info on new dir with mkdir"""
254
 
  svntest.actions.make_repo_and_wc(sbox)
 
254
  sbox.build()
255
255
  wc_dir = sbox.wc_dir
256
256
 
257
257
  # create a new directory using svn mkdir
273
273
  svntest.actions.run_and_verify_info([expected], new_dir)
274
274
 
275
275
  # check XML info
276
 
  exit_code, output, error = svntest.actions.run_and_verify_svn(None, None,
 
276
  exit_code, output, error = svntest.actions.run_and_verify_svn(None,
277
277
                                                                [], 'info',
278
278
                                                                new_dir,
279
279
                                                                '--xml')
351
351
    non_existent_path = os.path.join(wc_dir, 'non-existent')
352
352
 
353
353
    # All targets are existing
354
 
    svntest.actions.run_and_verify_svn2(None, None, [],
 
354
    svntest.actions.run_and_verify_svn2(None, [],
355
355
                                        0, 'info', alpha, beta)
356
356
 
357
357
    # One non-existing target
374
374
    non_existent_url = sbox.repo_url +  '/non-existent'
375
375
 
376
376
    # All targets are existing
377
 
    svntest.actions.run_and_verify_svn2(None, None, [],
 
377
    svntest.actions.run_and_verify_svn2(None, [],
378
378
                                        0, 'info', alpha, beta)
379
379
 
380
380
    # One non-existing target
483
483
  expected_error = 'svn: E200009: Could not display info for all targets.*'
484
484
 
485
485
  # Expect error on iota (status = not-present)
486
 
  svntest.actions.run_and_verify_svn(None, [], expected_error, 'info', iota)
 
486
  svntest.actions.run_and_verify_svn([], expected_error, 'info', iota)
487
487
 
488
488
  sbox.simple_update()
489
489
 
490
490
  # Expect error on iota (unversioned)
491
 
  svntest.actions.run_and_verify_svn(None, [], expected_error, 'info', iota)
 
491
  svntest.actions.run_and_verify_svn([], expected_error, 'info', iota)
492
492
 
493
493
@Issue(3998)
494
494
def binary_tree_conflict(sbox):
516
516
  })
517
517
  svntest.actions.run_and_verify_update(iota,
518
518
                                        expected_output, None, expected_status,
519
 
                                        None, None, None, None, None, False,
 
519
                                        [], False,
520
520
                                        iota, '-r', '2')
521
521
 
522
522
  expected_info = [{
558
558
 
559
559
  # Also test the local path (to help resolving the relative path) and an
560
560
  # unescaped path which the client should automatically encode
561
 
  svntest.actions.run_and_verify_svn(None, None, [], 'info',
 
561
  svntest.actions.run_and_verify_svn(None, [], 'info',
562
562
                                     info[0]['Relative URL'],
563
563
                                     info[0]['URL'],
564
564
                                     testpath,
591
591
  svntest.actions.run_and_verify_update(wc_dir,
592
592
                                        expected_output, None, None)
593
593
 
 
594
def node_hidden_info(sbox):
 
595
  "fetch svn info on 'hidden' nodes"
 
596
 
 
597
  sbox.build()
 
598
 
 
599
  sbox.simple_rm('A/B/E/alpha')
 
600
  sbox.simple_commit()
 
601
  svntest.actions.run_and_verify_svn(None, [],
 
602
                                     'up', '--set-depth', 'exclude',
 
603
                                     sbox.ospath('A/B/E/beta'))
 
604
 
 
605
  sbox.simple_copy('A/B/E', 'E')
 
606
 
 
607
  # Running info on BASE not-present fails
 
608
  expected_err = '.*(E|W)155010: The node \'.*alpha\' was not found.*'
 
609
  svntest.actions.run_and_verify_svn(None, expected_err,
 
610
                                     'info', sbox.ospath('A/B/E/alpha'))
 
611
 
 
612
  expected_info = [
 
613
    {
 
614
        'Path': re.escape(sbox.ospath('A/B/E/beta')),
 
615
        'Schedule': 'normal',
 
616
        'Depth': 'exclude',
 
617
        'Node Kind': 'file',
 
618
    },
 
619
    {
 
620
        'Path': re.escape(sbox.ospath('E/alpha')),
 
621
        'Schedule': 'delete',
 
622
        'Depth': 'exclude',
 
623
        'Node Kind': 'unknown',
 
624
    },
 
625
    {
 
626
        'Path': re.escape(sbox.ospath('E/beta')),
 
627
        'Schedule': 'normal',
 
628
        'Depth': 'exclude',
 
629
        'Node Kind': 'file',
 
630
    }
 
631
  ]
 
632
 
 
633
  svntest.actions.run_and_verify_info(expected_info,
 
634
                                      sbox.ospath('A/B/E/beta'),
 
635
                                      sbox.ospath('E/alpha'),
 
636
                                      sbox.ospath('E/beta'))
 
637
 
 
638
 
 
639
def info_item_simple(sbox):
 
640
  "show one info item"
 
641
 
 
642
  sbox.build(read_only=True)
 
643
  svntest.actions.run_and_verify_svn(
 
644
    '1', [],
 
645
    'info', '--show-item=revision', '--no-newline',
 
646
    sbox.ospath(''))
 
647
 
 
648
 
 
649
def info_item_simple_multiple(sbox):
 
650
  "show one info item with multiple targets"
 
651
 
 
652
  sbox.build(read_only=True)
 
653
 
 
654
  svntest.actions.run_and_verify_svn(
 
655
    r'^jrandom\s+\S+(/|\\)info_tests-\d+((/|\\)[^/\\]+)?$', [],
 
656
    'info', '--show-item=last-changed-author',
 
657
    '--depth=immediates', sbox.ospath(''))
 
658
 
 
659
  svntest.actions.run_and_verify_svn(
 
660
    r'^1\s+\S+(/|\\)info_tests-\d+(/|\\)[^/\\]+$', [],
 
661
    'info', '--show-item=last-changed-revision',
 
662
    sbox.ospath('A'), sbox.ospath('iota'))
 
663
 
 
664
 
 
665
def info_item_url(sbox):
 
666
  "show one info item with URL targets"
 
667
 
 
668
  sbox.build(create_wc=False, read_only=True)
 
669
 
 
670
  svntest.actions.run_and_verify_svn(
 
671
    '1', [],
 
672
    'info', '--show-item=last-changed-revision',
 
673
    sbox.repo_url)
 
674
 
 
675
 
 
676
  svntest.actions.run_and_verify_svn(
 
677
    r'^1\s+[^/:]+://.+/repos/[^/]+$', [],
 
678
    'info', '--show-item=last-changed-revision',
 
679
    sbox.repo_url + '/A', sbox.repo_url + '/iota')
 
680
 
 
681
 
 
682
  # Empty working copy root on URL targets
 
683
  svntest.actions.run_and_verify_svn(
 
684
    '', [],
 
685
    'info', '--show-item=wc-root',
 
686
    sbox.repo_url)
 
687
 
 
688
 
 
689
def info_item_uncommmitted(sbox):
 
690
  "show one info item on uncommitted targets"
 
691
 
 
692
  sbox.build()
 
693
 
 
694
  svntest.main.file_write(sbox.ospath('newfile'), 'newfile')
 
695
  sbox.simple_add('newfile')
 
696
  sbox.simple_mkdir('newdir')
 
697
 
 
698
  svntest.actions.run_and_verify_svn(
 
699
    '', [],
 
700
    'info', '--show-item=last-changed-revision',
 
701
    sbox.ospath('newfile'))
 
702
 
 
703
  svntest.actions.run_and_verify_svn(
 
704
    '', [],
 
705
    'info', '--show-item=last-changed-author',
 
706
    sbox.ospath('newdir'))
 
707
 
 
708
  svntest.actions.run_and_verify_svn(
 
709
    r'\s+\S+(/|\\)new(file|dir)', [],
 
710
    'info', '--show-item=last-changed-date',
 
711
    sbox.ospath('newfile'), sbox.ospath('newdir'))
 
712
 
 
713
  svntest.actions.run_and_verify_svn(
 
714
    r'\^/new(file|dir)\s+\S+(/|\\)new(file|dir)', [],
 
715
    'info', '--show-item=relative-url',
 
716
    sbox.ospath('newfile'), sbox.ospath('newdir'))
 
717
 
 
718
 
 
719
def info_item_failures(sbox):
 
720
  "failure modes of 'svn info --show-item'"
 
721
 
 
722
  sbox.build(read_only=True)
 
723
 
 
724
  svntest.actions.run_and_verify_svn(
 
725
    None, r'.*E200009:.*',
 
726
    'info', '--show-item=revision',
 
727
    sbox.ospath('not-there'))
 
728
 
 
729
  svntest.actions.run_and_verify_svn(
 
730
    None, r".*E205000: .*; did you mean 'wc-root'\?",
 
731
    'info', '--show-item=root',
 
732
    sbox.ospath(''))
 
733
 
 
734
  svntest.actions.run_and_verify_svn(
 
735
    None, (r".*E205000: --show-item is not valid in --xml mode"),
 
736
    'info', '--show-item=revision', '--xml',
 
737
    sbox.ospath(''))
 
738
 
 
739
  svntest.actions.run_and_verify_svn(
 
740
    None, (r".*E205000: --incremental is only valid in --xml mode"),
 
741
    'info', '--show-item=revision', '--incremental',
 
742
    sbox.ospath(''))
 
743
 
 
744
  svntest.actions.run_and_verify_svn(
 
745
    None, (r".*E205000: --no-newline is only available.*"),
 
746
    'info', '--show-item=revision', '--no-newline',
 
747
    sbox.ospath('A'), sbox.ospath('iota'))
 
748
 
 
749
 
594
750
########################################################################
595
751
# Run the tests
596
752
 
606
762
              info_show_exclude,
607
763
              binary_tree_conflict,
608
764
              relpath_escaping,
 
765
              node_hidden_info,
 
766
              info_item_simple,
 
767
              info_item_simple_multiple,
 
768
              info_item_url,
 
769
              info_item_uncommmitted,
 
770
              info_item_failures,
609
771
             ]
610
772
 
611
773
if __name__ == '__main__':