コード例 #1
0
 def test_dir(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir(alias="rambo", path="test/test1")
         if fsm.dir("rambo") is None:
             raise Exception("Couldn't find a directory")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #2
0
ファイル: test_fs_manager.py プロジェクト: hufh/fs-manager
 def test_mkdir(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("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)
コード例 #3
0
 def test_mkdir(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("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
ファイル: test_fs_manager.py プロジェクト: hufh/fs-manager
 def test_dir(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir(alias="rambo", path="test/test1")
         if fsm.dir("rambo") is None:
             raise Exception("Couldn't find a directory")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #5
0
ファイル: test_fs_manager.py プロジェクト: hufh/fs-manager
 def test_exists(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("test1/test2")
         if os.path.exists(fsm.dir("test1/test2").path) != \
                 fsm.exists("test1/test2"):
             raise Exception("Exists at relative doesn't work")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #6
0
 def test_exists(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("test1/test2")
         if os.path.exists(fsm.dir("test1/test2").path) != \
                 fsm.exists("test1/test2"):
             raise Exception("Exists at relative doesn't work")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #7
0
ファイル: test_fs_manager.py プロジェクト: hufh/fs-manager
 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)
コード例 #8
0
ファイル: test_fs_manager.py プロジェクト: hufh/fs-manager
 def test_mv_dir_path(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("rambo", "test1/test2/test3")
         fsm.mv("rambo", "mambo", "test1/test22/test33")
         if not (fsm.dir("mambo") is not None and os.path.exists(
                 os.path.join(fsm.prefix_path, "test1/test22/test33"))):
             raise Exception("Directory hasn't been moved")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #9
0
 def test_rm_dir(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("rambo", "test1/test2/test3")
         fsm.rm("rambo")
         fsm.ls()
         if fsm.exists("test1/test2/test3"):
             raise Exception("Directory hasn't been removed")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #10
0
ファイル: test_fs_manager.py プロジェクト: hufh/fs-manager
 def test_chalias(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("rambo", "test1/test2/test3")
         fsm.chalias("rambo", "mambo")
         if not (fsm.dir("mambo") is not None and os.path.exists(
                 os.path.join(fsm.prefix_path, "test1/test2/test3"))):
             raise Exception("Error occurred while changing alias")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #11
0
ファイル: test_fs_manager.py プロジェクト: hufh/fs-manager
 def test_rm_dir(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("rambo", "test1/test2/test3")
         fsm.rm("rambo")
         fsm.ls()
         if fsm.exists("test1/test2/test3"):
             raise Exception("Directory hasn't been removed")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #12
0
ファイル: test_fs_manager.py プロジェクト: hufh/fs-manager
 def test_cp_dir_alias(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("rambo", "test1/test2/test3")
         fsm.cp("rambo", "test1/test22/test33")
         if not (fsm.dir("test1/test22/test33") is not None
                 and fsm.exists("test1/test22/test33")):
             raise Exception("Directory hasn't been copied")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #13
0
ファイル: test_fs_manager.py プロジェクト: hufh/fs-manager
 def test_chmod_dir(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("rambo", "test1/test2/test3")
         fsm.chmod("rambo", 0o644)
         if oct(os.stat(fsm.dir("rambo").path).st_mode
                & 0o777) != oct(0o644):
             raise Exception("Wrong mode of directory")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #14
0
 def test_chmod_dir(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("rambo", "test1/test2/test3")
         fsm.chmod("rambo", 0o644)
         if oct(os.stat(fsm.dir("rambo").path).
                st_mode & 0o777) != oct(0o644):
             raise Exception("Wrong mode of directory")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #15
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)
コード例 #16
0
 def test_mv_dir_alias(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("rambo", "test1/test2/test3")
         fsm.mv("rambo", "test1/test22/test33")
         if not (fsm.dir("test1/test22/test33") is not None and
                 fsm.exists("test1/test22/test33")):
             raise Exception("Directory hasn't been moved")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #17
0
 def test_cp_dir_path(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("rambo", "test1/test2/test3")
         fsm.cp("rambo", "mambo", "test1/test22/test33")
         if not (fsm.dir("mambo") is not None and
                 os.path.exists(os.path.join(fsm.prefix_path,
                                             "test1/test22/test33"))):
             raise Exception("Directory hasn't been copied")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)
コード例 #18
0
 def test_chalias(self):
     try:
         fsm = FSManager(temporary=True)
         fsm.mkdir("rambo", "test1/test2/test3")
         fsm.chalias("rambo", "mambo")
         if not (fsm.dir("mambo") is not None and
                 os.path.exists(os.path.join(fsm.prefix_path,
                                             "test1/test2/test3"))):
             raise Exception("Error occurred while changing alias")
     except Exception as exc:
         traceback.print_exc()
         self.fail(exc)