コード例 #1
0
 def test08_file_hash(self):
     logging.getLogger("HiveFileTestCase").debug(
         "\nRunning test_k_file_hash")
     path = 'folder1/test_07.txt'
     create_upload_file(self, path, f"Hello Temp {path}!")
     r1, s = self.parse_response(
         self.test_client.get(f'/api/v1/files/file/hash?path={path}',
                              headers=self.auth))
     self.assert200(s)
     self.assertEqual(r1["_status"], "OK")
     logging.getLogger("HiveFileTestCase").debug(json.dumps(r1))
コード例 #2
0
 def test04_download_file(self):
     logging.getLogger("HiveFileTestCase").debug(
         "\nRunning test_f_download_file")
     path, file_content = "folder1/test_01.txt", "Hello Temp folder1/test_01.txt!"
     create_upload_file(self, path, file_content)
     r = self.test_client.get(f'api/v1/files/download?path={path}',
                              headers=self.auth)
     self.assert200(r.status_code)
     self.assertEqual(r.get_data(as_text=True), file_content)
     logging.getLogger("HiveFileTestCase").debug("data:" +
                                                 r.get_data(as_text=True))
コード例 #3
0
    def test06_copy_file(self):
        logging.getLogger("HiveFileTestCase").debug(
            "\nRunning test_i_copy_file")
        src_path, dst_path = 'folder1/test_04.txt', 'folder1/test_05.txt'
        create_upload_file(self, src_path, f"Hello Temp {src_path}!")

        move_file = {"src_path": src_path, "dst_path": dst_path}
        rt, s = self.parse_response(
            self.test_client.post('/api/v1/files/copy',
                                  data=json.dumps(move_file),
                                  headers=self.upload_auth))
        self.assert200(s)
        self.assertEqual(rt["_status"], "OK")

        self.check_file_exists(src_path)
        self.check_file_exists(dst_path)
コード例 #4
0
    def test09_delete_file(self):
        logging.getLogger("HiveFileTestCase").debug(
            "\nRunning test_l_delete_file")
        path = 'folder1/test_08.txt'
        create_upload_file(self, path, f"Hello Temp {path}!")
        r, s = self.parse_response(
            self.test_client.post('/api/v1/files/delete',
                                  data=json.dumps({"path": path}),
                                  headers=self.auth))
        self.assert200(s)

        self.check_file_exists(path, exists=False)
        self.do_remove_file("test_0.txt")
        self.do_remove_file("folder1/test_0.txt")
        self.do_remove_file("folder1/folder2/folder3/test_0.txt")
        self.do_remove_file("folder1/test_01.txt")
        self.do_remove_file("folder1/test_02.txt")
        self.do_remove_file("folder1/test_03.txt")
        self.do_remove_file("folder1/test_04.txt")
        self.do_remove_file("folder1/test_05.txt")
        self.do_remove_file("folder1/test_06.txt")
        self.do_remove_file("folder1/test_07.txt")
        self.do_remove_file("folder1/test_08.txt")
コード例 #5
0
 def test07_file_properties(self):
     logging.getLogger("HiveFileTestCase").debug("Test file_properties.")
     path = 'folder1/test_06.txt'
     create_upload_file(self, path, f"Hello Temp {path}!")
     self.check_file_exists(path)
コード例 #6
0
 def test03_create_and_upload_file_further_folder(self):
     logging.getLogger("HiveFileTestCase").debug(
         "\nRunning test_d_create_and_upload_file_further_folder")
     path = "folder1/folder2/folder3/test_0.txt"
     create_upload_file(self, path, f"Hello Temp {path}!")
コード例 #7
0
 def test01_create_and_upload_file_root(self):
     logging.getLogger("HiveFileTestCase").debug(
         "\nRunning test_b_create_and_upload_file_root")
     path = "test_0.txt"
     create_upload_file(self, path, f"Hello Temp {path}!")