386
self.assertPathExists('dir')
387
self.assertPathExists('dir2')
386
self.failUnlessExists('dir')
387
self.failUnlessExists('dir2')
390
390
class TestCd(script.TestCaseWithTransportAndScript):
481
481
def test_rm_file(self):
482
482
self.run_script('$ echo content >file')
483
self.assertPathExists('file')
483
self.failUnlessExists('file')
484
484
self.run_script('$ rm file')
485
self.assertPathDoesNotExist('file')
485
self.failIfExists('file')
487
487
def test_rm_file_force(self):
488
self.assertPathDoesNotExist('file')
488
self.failIfExists('file')
489
489
self.run_script('$ rm -f file')
490
self.assertPathDoesNotExist('file')
490
self.failIfExists('file')
492
492
def test_rm_files(self):
493
493
self.run_script("""
494
494
$ echo content >file
495
495
$ echo content >file2
497
self.assertPathExists('file2')
497
self.failUnlessExists('file2')
498
498
self.run_script('$ rm file file2')
499
self.assertPathDoesNotExist('file2')
499
self.failIfExists('file2')
501
501
def test_rm_dir(self):
502
502
self.run_script('$ mkdir dir')
503
self.assertPathExists('dir')
503
self.failUnlessExists('dir')
504
504
self.run_script("""
506
506
2>rm: cannot remove 'dir': Is a directory
508
self.assertPathExists('dir')
508
self.failUnlessExists('dir')
510
510
def test_rm_dir_recursive(self):
511
511
self.run_script("""
515
self.assertPathDoesNotExist('dir')
515
self.failIfExists('dir')
518
518
class TestMv(script.TestCaseWithTransportAndScript):
525
525
def test_move_file(self):
526
526
self.run_script('$ echo content >file')
527
self.assertPathExists('file')
527
self.failUnlessExists('file')
528
528
self.run_script('$ mv file new_name')
529
self.assertPathDoesNotExist('file')
530
self.assertPathExists('new_name')
529
self.failIfExists('file')
530
self.failUnlessExists('new_name')
532
532
def test_move_unknown_file(self):
533
533
self.assertRaises(AssertionError,
539
539
$ echo content >dir/file
541
541
self.run_script('$ mv dir new_name')
542
self.assertPathDoesNotExist('dir')
543
self.assertPathExists('new_name')
544
self.assertPathExists('new_name/file')
542
self.failIfExists('dir')
543
self.failUnlessExists('new_name')
544
self.failUnlessExists('new_name/file')
546
546
def test_move_file_into_dir(self):
547
547
self.run_script("""
549
549
$ echo content > file
551
551
self.run_script('$ mv file dir')
552
self.assertPathExists('dir')
553
self.assertPathDoesNotExist('file')
554
self.assertPathExists('dir/file')
552
self.failUnlessExists('dir')
553
self.failIfExists('file')
554
self.failUnlessExists('dir/file')
557
557
class cmd_test_confirm(commands.Command):