Ejemplo n.º 1
0
 def test_softlink_a_file_emptyparentfile(self):
     allowed=dict()
     allowed['name']=(str,"","Directory name")
     mybc=BaseChecker(allowed,name='files')
     mybc.softlink_a_file('childdir','emptyfile')
     myfiles=dirutil.walkfiles("childdir")
     print myfiles
     #self.assertTrue("childdir/CHGCAR" in myfiles)
     listme=subprocess.Popen("ls -l childdir",stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
     listres=listme.communicate()[0]
     listme.wait()
     print listres
     self.assertTrue("files/emptyfile" in listres)
Ejemplo n.º 2
0
 def test_softlink_a_file_child_file_exists(self):
     allowed=dict()
     allowed['name']=(str,"","Directory name")
     shutil.copy('files/another_alphatest','childdir/alphatest')
     mybc=BaseChecker(allowed,name='files')
     mybc.softlink_a_file('childdir','alphatest')
     myfiles=dirutil.walkfiles("childdir")
     print myfiles
     #self.assertTrue("childdir/CHGCAR" in myfiles)
     listme=subprocess.Popen("ls -l childdir",stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
     listres=listme.communicate()[0]
     listme.wait()
     print listres
     self.assertFalse("files/alphatest" in listres)
     self.assertTrue("childdir/alphatest" in myfiles)
Ejemplo n.º 3
0
 def test_softlink_a_file_emptyparentfile(self):
     allowed = dict()
     allowed['name'] = (str, "", "Directory name")
     mybc = BaseChecker(allowed, name='files')
     mybc.softlink_a_file('childdir', 'emptyfile')
     myfiles = dirutil.walkfiles("childdir")
     print myfiles
     #self.assertTrue("childdir/CHGCAR" in myfiles)
     listme = subprocess.Popen("ls -l childdir",
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE,
                               shell=True)
     listres = listme.communicate()[0]
     listme.wait()
     print listres
     self.assertTrue("files/emptyfile" in listres)
Ejemplo n.º 4
0
 def test_softlink_a_file_child_file_exists(self):
     allowed = dict()
     allowed['name'] = (str, "", "Directory name")
     shutil.copy('files/another_alphatest', 'childdir/alphatest')
     mybc = BaseChecker(allowed, name='files')
     mybc.softlink_a_file('childdir', 'alphatest')
     myfiles = dirutil.walkfiles("childdir")
     print myfiles
     #self.assertTrue("childdir/CHGCAR" in myfiles)
     listme = subprocess.Popen("ls -l childdir",
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE,
                               shell=True)
     listres = listme.communicate()[0]
     listme.wait()
     print listres
     self.assertFalse("files/alphatest" in listres)
     self.assertTrue("childdir/alphatest" in myfiles)
Ejemplo n.º 5
0
 def test_softlink_a_file_child_softlink_exists(self):
     print "CURDIR: ", os.getcwd()
     allowed=dict()
     allowed['name']=(str,"","Directory name")
     os.chdir("childdir")
     linkme=subprocess.Popen("ln -s ../files/another_alphatest alphatest",shell=True)
     linkme.wait()
     os.chdir(testdir)
     mybc=BaseChecker(allowed,name='files')
     mybc.softlink_a_file('childdir','alphatest')
     myfiles=dirutil.walkfiles("childdir")
     print myfiles
     #self.assertTrue("childdir/CHGCAR" in myfiles)
     listme=subprocess.Popen("ls -l childdir",stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
     listres=listme.communicate()[0]
     listme.wait()
     print listres
     self.assertTrue("files/another_alphatest" in listres)
     self.assertTrue("childdir/alphatest" in myfiles)
Ejemplo n.º 6
0
 def test_softlink_a_file_child_softlink_exists(self):
     print "CURDIR: ", os.getcwd()
     allowed = dict()
     allowed['name'] = (str, "", "Directory name")
     os.chdir("childdir")
     linkme = subprocess.Popen("ln -s ../files/another_alphatest alphatest",
                               shell=True)
     linkme.wait()
     os.chdir(testdir)
     mybc = BaseChecker(allowed, name='files')
     mybc.softlink_a_file('childdir', 'alphatest')
     myfiles = dirutil.walkfiles("childdir")
     print myfiles
     #self.assertTrue("childdir/CHGCAR" in myfiles)
     listme = subprocess.Popen("ls -l childdir",
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE,
                               shell=True)
     listres = listme.communicate()[0]
     listme.wait()
     print listres
     self.assertTrue("files/another_alphatest" in listres)
     self.assertTrue("childdir/alphatest" in myfiles)