Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/google_drive/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module Util
'.htm' => 'text/html',
'.html' => 'text/html',
'.zip' => 'application/zip',
'.epub' => 'application/epub+zip',
'.swf' => 'application/x-shockwave-flash'
}.freeze

Expand Down
34 changes: 34 additions & 0 deletions test/test_google_drive_export.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# test/test_google_drive_export.rb

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
require 'yaml'

require 'rubygems'
require 'bundler/setup'
require 'highline'
require 'test/unit'

require 'google_drive'
require_relative 'test_helper'

class TestGoogleDriveExport < Test::Unit::TestCase
include(SessionHelper)

def test_upload_and_download
session = get_session
return unless auth_type == AuthType::USER_ACCOUNT
test_file_path = File.join(File.dirname(__FILE__), 'test_file.txt')
test_file_title = 'test_file_123.txt'
file = session.upload_from_file(
test_file_path, test_file_title, convert: true
)
assert { file.is_a?(GoogleDrive::File) }
assert { file.title == "test_file_123" }
assert { file.available_content_types == [] }
assert { file.mime_type == 'application/vnd.google-apps.document' }
download_path = File.join(File.dirname(__FILE__), 'sample-epub-file-dl.epub')
file.export_as_file(download_path)
assert { File.exist?(download_path) }
File.delete(download_path)
end
end