diff options
Diffstat (limited to 'test/service/gcs_service_test.rb')
-rw-r--r-- | test/service/gcs_service_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/service/gcs_service_test.rb b/test/service/gcs_service_test.rb index 7d4700498b..3d70080af4 100644 --- a/test/service/gcs_service_test.rb +++ b/test/service/gcs_service_test.rb @@ -1,4 +1,5 @@ require "service/shared_service_tests" +require "httparty" if SERVICE_CONFIGURATIONS[:gcs] class ActiveStorage::Service::GCSServiceTest < ActiveSupport::TestCase @@ -6,6 +7,25 @@ if SERVICE_CONFIGURATIONS[:gcs] include ActiveStorage::Service::SharedServiceTests + test "direct upload" do + begin + key = SecureRandom.base58(24) + data = "Something else entirely!" + direct_upload_url = @service.url_for_direct_upload(key, expires_in: 5.minutes, content_type: "text/plain", content_length: data.size) + + HTTParty.put( + direct_upload_url, + body: data, + headers: { "Content-Type" => "text/plain" }, + debug_output: STDOUT + ) + + assert_equal data, @service.download(key) + ensure + @service.delete key + end + end + test "signed URL generation" do travel_to Time.now do url = SERVICE.bucket.signed_url(FIXTURE_KEY, expires: 120) + |