Beispiel #1
0
 def test_do_init_should_create_correct_structure(self):
     args = self.parser.parse_args(['init', '-d', self.temp_dir])
     argdict = vars(args)
     s2.dispatch(argdict)  #this triggers call to do_init
     # now verify that the tree structure is correct.
     self.assertTrue(s2site.verify_dir_structure(self.temp_dir),
                     "tree structure was incorrect after init command.")
Beispiel #2
0
 def test_verify_dir_structure_on_nonwritable_complete_s2dir_should_return_false(self):
     # rename each dir in turn,set non-writable and assess the call
     for d in self.dirs:
         fp = os.path.join(self.base_dir,d)
         set_directory_writability(fp,False)
         self.assertFalse(s2site.verify_dir_structure(self.base_dir), 
                          'verify_tree_structure did NOT return False on a non-writable complete s2 dir.')
Beispiel #3
0
 def test_verify_dir_structure_on_writable_incomplete_s2dir_should_return_false(self):
     # rename each dir in turn, and assess the call
     for d in self.dirs:
         fp = os.path.join(self.base_dir,d)
         ffp = fp + 'x'
         shutil.move(fp,ffp)
         self.assertFalse(s2site.verify_dir_structure(self.base_dir), 
                          'verify_tree_structure did NOT return False on a writable incomplete s2 dir.')
Beispiel #4
0
 def test_verify_dir_structure_on_nonwritable_incomplete_s2dir_should_return_false(self):
     #just test one case, it's enough. Make one dir non writeable, and rename another one
     fp = os.path.join(self.base_dir,'www')
     set_directory_writability(fp,False)
     fp = os.path.join(self.base_dir,'common')
     ffp = fp + 'x'
     shutil.move(fp,ffp)
     self.assertFalse(s2site.verify_dir_structure(self.base_dir), 
                          'verify_tree_structure did NOT return False on a non-writable incomplete s2 dir.')
Beispiel #5
0
 def test_verify_dir_structure_on_nonwritable_complete_s2dir_should_return_false(
         self):
     # rename each dir in turn,set non-writable and assess the call
     for d in self.dirs:
         fp = os.path.join(self.base_dir, d)
         set_directory_writability(fp, False)
         self.assertFalse(
             s2site.verify_dir_structure(self.base_dir),
             'verify_tree_structure did NOT return False on a non-writable complete s2 dir.'
         )
Beispiel #6
0
 def test_verify_dir_structure_on_writable_incomplete_s2dir_should_return_false(
         self):
     # rename each dir in turn, and assess the call
     for d in self.dirs:
         fp = os.path.join(self.base_dir, d)
         ffp = fp + 'x'
         shutil.move(fp, ffp)
         self.assertFalse(
             s2site.verify_dir_structure(self.base_dir),
             'verify_tree_structure did NOT return False on a writable incomplete s2 dir.'
         )
Beispiel #7
0
 def test_verify_dir_structure_on_nonwritable_incomplete_s2dir_should_return_false(
         self):
     #just test one case, it's enough. Make one dir non writeable, and rename another one
     fp = os.path.join(self.base_dir, 'www')
     set_directory_writability(fp, False)
     fp = os.path.join(self.base_dir, 'common')
     ffp = fp + 'x'
     shutil.move(fp, ffp)
     self.assertFalse(
         s2site.verify_dir_structure(self.base_dir),
         'verify_tree_structure did NOT return False on a non-writable incomplete s2 dir.'
     )
Beispiel #8
0
 def test_do_init_should_create_correct_structure(self):
     args = self.parser.parse_args(['init','-d',self.temp_dir])
     argdict = vars(args)
     s2.dispatch(argdict)  #this triggers call to do_init
     # now verify that the tree structure is correct.
     self.assertTrue(s2site.verify_dir_structure(self.temp_dir),"tree structure was incorrect after init command.")
Beispiel #9
0
 def test_verify_dir_structure_on_writable_complete_s2dir_should_return_true(
         self):
     self.assertTrue(
         s2site.verify_dir_structure(self.base_dir),
         'verify_tree_structure did not return true on a writable complete s2 dir.'
     )
Beispiel #10
0
 def test_verify_dir_structure_inexistent_dir_should_return_false(self):
     rp = random_path()
     self.assertFalse(
         s2site.verify_dir_structure(rp),
         'verify_tree_structure did not return False on an inexistent random directory'
     )
Beispiel #11
0
 def test_verify_dir_structure_on_writable_complete_s2dir_should_return_true(self):
     self.assertTrue(s2site.verify_dir_structure(self.base_dir), 
                    'verify_tree_structure did not return true on a writable complete s2 dir.')
Beispiel #12
0
 def test_verify_dir_structure_inexistent_dir_should_return_false(self):
     rp = random_path()
     self.assertFalse(s2site.verify_dir_structure(rp), 
                    'verify_tree_structure did not return False on an inexistent random directory')