Ejemplo n.º 1
0
    def test_delete_file(self):
        new_file_name = generate_random_string()
        create_new_file(join(self.tempdir, new_file_name))

        # When
        self.disk.delete_file(new_file_name)

        # Then
        self.assertEqual(get_number_of_files_in_dir(self.tempdir), 0)
Ejemplo n.º 2
0
    def test_delete_file(self):
        new_file_name = generate_random_string()
        create_new_file(join(self.tempdir, new_file_name))

        # When
        self.disk.delete_file(new_file_name)

        # Then
        self.assertEqual(get_number_of_files_in_dir(self.tempdir), 0)
Ejemplo n.º 3
0
    def test_download_file(self):
        # Given
        new_file_name = generate_random_string()
        create_new_file(join(self.tempdir, new_file_name))
        download_dir = create_random_dir()

        # When
        self.disk.download_file(new_file_name, download_dir)

        # Then
        self.assertEqual(get_number_of_files_in_dir(download_dir), 1)

        # Clean
        delete_dir(download_dir)
Ejemplo n.º 4
0
    def test_download_file(self):
        # Given
        new_file_name = generate_random_string()
        create_new_file(join(self.tempdir, new_file_name))
        download_dir = create_random_dir()

        # When
        self.disk.download_file(new_file_name, download_dir)

        # Then
        self.assertEqual(get_number_of_files_in_dir(download_dir), 1)

        # Clean
        delete_dir(download_dir)
Ejemplo n.º 5
0
 def upload_new_file(self, local_file_path):
     file_name = generate_random_string()
     with open(local_file_path, 'rb') as f:
         self.client.put_file(file_name, f, overwrite=False)
     return file_name
Ejemplo n.º 6
0
 def upload_new_file(self, local_file_path):
     new_file = self.client.folder(folder_id=self.root_folder_id).upload(local_file_path, file_name = generate_random_string())
     return new_file.get()['id']
Ejemplo n.º 7
0
 def upload_new_file(self, local_file_path):
     new_file = self.client.folder(folder_id=self.root_folder_id).upload(
         local_file_path, file_name=generate_random_string())
     return new_file.get()['id']
Ejemplo n.º 8
0
 def upload_new_file(self, local_file_path):
     file_name = generate_random_string()
     with open(local_file_path, 'rb') as f:
         self.client.put_file(file_name, f, overwrite=False)
     return file_name