예제 #1
0
 def test_file(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile(alias="rambo", path="test/test1")
         if fsm.file("rambo") is None:
             raise Exception("Couldn't find a file")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #2
0
 def test_file(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile(alias="rambo", path="test/test1")
         if fsm.file("rambo") is None:
             raise Exception("Couldn't find a file")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #3
0
 def test_mkfile(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile("test/test1")
         if not os.path.exists(os.path.join(fsm.prefix_path, "test")):
             raise Exception("File hasn't been created")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #4
0
 def test_mkfile(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile("test/test1")
         if not os.path.exists(os.path.join(fsm.prefix_path, "test")):
             raise Exception("File hasn't been created")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #5
0
 def test_remove(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("test1/test2")
         fsm.mkfile("test3/test4/test_file")
         fsm.remove()
         if os.path.exists(fsm.prefix_path):
             raise Exception("Couldn't remove all resources under prefix")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #6
0
 def test_mv_file_path(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile("rambo", "test1/test2/test3")
         fsm.mv("rambo", "mambo", "test1/test22/test33")
         if not (fsm.file("mambo") is not None and os.path.exists(
                 os.path.join(fsm.prefix_path, "test1/test22/test33"))):
             raise Exception("File hasn't been moved")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #7
0
 def test_cp_file_alias(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile("rambo", "test1/test2/test3")
         fsm.cp("rambo", "test1/test22/test33")
         if not (fsm.file("test1/test22/test33") is not None
                 and fsm.exists("test1/test22/test33")):
             raise Exception("File hasn't been copied")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #8
0
 def test_rm_file(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile("rambo", "test1/test2/test3")
         fsm.rm("rambo")
         fsm.ls()
         if fsm.exists("test1/test2/test3"):
             raise Exception("File hasn't been removed")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #9
0
 def test_chmod_file(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile("rambo", "test1/test2/test3")
         fsm.chmod("rambo", 0o644)
         if oct(os.stat(fsm.file("rambo").path).st_mode
                & 0o777) != oct(0o644):
             raise Exception("Wrong mode of file")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #10
0
 def test_remove(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("test1/test2")
         fsm.mkfile("test3/test4/test_file")
         fsm.remove()
         if os.path.exists(fsm.prefix_path):
             raise Exception("Couldn't remove all resources under prefix")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #11
0
 def test_mv_file_alias(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile("rambo", "test1/test2/test3")
         fsm.mv("rambo", "test1/test22/test33")
         if not (fsm.file("test1/test22/test33") is not None and
                 fsm.exists("test1/test22/test33")):
             raise Exception("File hasn't been moved")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #12
0
 def test_rm_file(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile("rambo", "test1/test2/test3")
         fsm.rm("rambo")
         fsm.ls()
         if fsm.exists("test1/test2/test3"):
             raise Exception("File hasn't been removed")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #13
0
 def test_chmod_file(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile("rambo", "test1/test2/test3")
         fsm.chmod("rambo", 0o644)
         if oct(os.stat(fsm.file("rambo").path).
                st_mode & 0o777) != oct(0o644):
             raise Exception("Wrong mode of file")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #14
0
 def test_open(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile(alias="rambo", path="test/test1")
         with fsm.open("rambo", "w") as f:
             f.write("rambo test")
         with open(fsm.file("rambo").path) as f:
             if f.readline() != "rambo test":
                 raise Exception("Couldn't write to file")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #15
0
 def test_open(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile(alias="rambo", path="test/test1")
         with fsm.open("rambo", "w") as f:
             f.write("rambo test")
         with open(fsm.file("rambo").path) as f:
             if f.readline() != "rambo test":
                 raise Exception("Couldn't write to file")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
예제 #16
0
 def test_cp_file_path(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkfile("rambo", "test1/test2/test3")
         fsm.cp("rambo", "mambo", "test1/test22/test33")
         if not (fsm.file("mambo") is not None and
                 os.path.exists(os.path.join(fsm.prefix_path,
                                             "test1/test22/test33"))):
             raise Exception("File hasn't been copied")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)