Esempio n. 1
0
    def test_upload_download_and_delete_new_file(self):
        # Given
        file_path = create_random_file()
        add_random_content_to_file(file_path)
        file_name = "newdatalordstest.dlords"
        out_file = generate_random_file_path()

        # When
        file_id = self.box.upload_new_file(file_path)
        self.box.download_file(file_id, out_file)

        # Then
        self.assertTrue(os.path.exists(out_file))
        self.assertTrue(get_size(out_file) > 0)

        # When
        self.box.delete_file(file_id)

        # Then
        with self.assertRaises(BoxAPIException):
            self.box.client.file(file_id=file_id).get()

        # Clean
        delete_file(file_path)
        delete_file(out_file)
Esempio n. 2
0
    def test_upload_download_update_and_delete_new_file(self):
        # Given
        file_path = create_random_file()
        add_random_content_to_file(file_path)
        previous_size = get_size(file_path)
        file_name = "newdatalordstest"
        out_file = generate_random_file_path()

        # When
        file_id = self.google_drive.upload_new_file(file_path)
        add_random_content_to_file(file_path)
        self.google_drive.update_file(file_path, file_id)
        self.google_drive.download_file(file_id, out_file)

        # Then
        self.assertTrue(os.path.exists(out_file))
        self.assertTrue(get_size(out_file) > previous_size)

        # When
        self.google_drive.delete_file(file_id)

        # Then
        # with self.assertRaises():
        self.google_drive.drive.CreateFile({'id' : file_id})

        # Clean
        delete_file(file_path)
Esempio n. 3
0
    def test_upload_download_and_delete_new_file(self):
        # Given
        file_path = create_random_file()
        add_random_content_to_file(file_path)
        file_name = "newdatalordstest.dlords"
        out_file = generate_random_file_path()

        # When
        file_id = self.box.upload_new_file(file_path)
        self.box.download_file(file_id, out_file)

        # Then
        self.assertTrue(os.path.exists(out_file))
        self.assertTrue(get_size(out_file) > 0)

        # When
        self.box.delete_file(file_id)

        # Then
        with self.assertRaises(BoxAPIException):
            self.box.client.file(file_id=file_id).get()

        # Clean
        delete_file(file_path)
        delete_file(out_file)
Esempio n. 4
0
    def test_download_file(self):
        # Given
        out_file = generate_random_file_path()

        # When
        self.dropbox.download_file("datalords-test.txt", out_file)

        # Then
        self.assertTrue(os.path.exists(out_file))

        # Clean
        delete_file(out_file)
Esempio n. 5
0
    def test_download_file(self):
        # Given
        out_file = generate_random_file_path()

        # When
        self.dropbox.download_file("datalords-test.txt", out_file)

        # Then
        self.assertTrue(os.path.exists(out_file))

        # Clean
        delete_file(out_file)