Exemplo n.º 1
0
 def test_dbd_initialdir_is_nonbase_but_a_parent_is_base_should_return_thebase(
         self):
     temp_dir = tempfile.mkdtemp()
     rfr = create_random_folders(temp_dir, 4, True)
     self.assertEqual(s2site.discover_base_dir(rfr['fullpath']),
                      rfr['basepath'],
                      'discover_base_dir not return the correct base_dir.')
     shutil.rmtree(temp_dir)
Exemplo n.º 2
0
 def test_dbd_initialdir_is_real_basedir_should_return_initialdir(self):
     temp_dir = tempfile.mkdtemp()
     os.mkdir(os.path.join(temp_dir, '.s2'))
     self.assertEqual(
         s2site.discover_base_dir(temp_dir), temp_dir,
         'discover_base_dir did not return the start dir when it was a true base dir.'
     )
     shutil.rmtree(temp_dir)
Exemplo n.º 3
0
 def test_dbd_initialdir_is_nonbase_and_no_base_upwards_should_return_Empty(self):
     temp_dir = tempfile.mkdtemp()
     #check id there's an .s2, remove it...
     if os.path.isdir(os.path.join(temp_dir,'.s2')):
         shutil.rmtree(os.path.join(temp_dir,'.s2'))
     dtd = s2site.discover_base_dir(temp_dir)
     self.assertEqual(dtd,None,'discover_base_dir not return empty string when initial_dir was NOT base, but had no base dir up the chain.')
     shutil.rmtree(temp_dir)
Exemplo n.º 4
0
 def test_dbd_initialdir_is_nonbase_and_no_base_upwards_should_return_Empty(
         self):
     temp_dir = tempfile.mkdtemp()
     #check id there's an .s2, remove it...
     if os.path.isdir(os.path.join(temp_dir, '.s2')):
         shutil.rmtree(os.path.join(temp_dir, '.s2'))
     dtd = s2site.discover_base_dir(temp_dir)
     self.assertEqual(
         dtd, None,
         'discover_base_dir not return empty string when initial_dir was NOT base, but had no base dir up the chain.'
     )
     shutil.rmtree(temp_dir)
Exemplo n.º 5
0
 def test_dbd_initialdir_is_nonbase_but_a_parent_is_base_should_return_thebase(self):
     temp_dir = tempfile.mkdtemp()
     rfr = create_random_folders(temp_dir,4,True)
     self.assertEqual(s2site.discover_base_dir(rfr['fullpath']),rfr['basepath'],'discover_base_dir not return the correct base_dir.')
     shutil.rmtree(temp_dir)
Exemplo n.º 6
0
 def test_dbd_initialdir_is_real_basedir_should_return_initialdir(self):
     temp_dir = tempfile.mkdtemp()
     os.mkdir(os.path.join(temp_dir,'.s2'))
     self.assertEqual(s2site.discover_base_dir(temp_dir),temp_dir,'discover_base_dir did not return the start dir when it was a true base dir.')
     shutil.rmtree(temp_dir)