aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-07-23 11:05:20 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-23 11:05:20 -0500
commit46da4ee7daf1ecaa2fc47a260ccb58e119a1b5ea (patch)
treebc19d2f900055e39de21f62ec27e9079723cfa5f /test
parent8f20624820ed0922b33fceb4013d3ff11015b366 (diff)
downloadrails-46da4ee7daf1ecaa2fc47a260ccb58e119a1b5ea.tar.gz
rails-46da4ee7daf1ecaa2fc47a260ccb58e119a1b5ea.tar.bz2
rails-46da4ee7daf1ecaa2fc47a260ccb58e119a1b5ea.zip
Switch to simpler signed_id for blob rather than full GlobalID
We don't need to lookup multiple different classes, so no need to use a globalid.
Diffstat (limited to 'test')
-rw-r--r--test/controllers/direct_uploads_controller_test.rb8
-rw-r--r--test/controllers/variants_controller_test.rb2
-rw-r--r--test/models/attachments_test.rb2
-rw-r--r--test/models/blob_test.rb1
-rw-r--r--test/models/verified_key_with_expiration_test.rb1
-rw-r--r--test/test_helper.rb6
6 files changed, 8 insertions, 12 deletions
diff --git a/test/controllers/direct_uploads_controller_test.rb b/test/controllers/direct_uploads_controller_test.rb
index 0083492929..06e76cfa8b 100644
--- a/test/controllers/direct_uploads_controller_test.rb
+++ b/test/controllers/direct_uploads_controller_test.rb
@@ -24,8 +24,8 @@ if SERVICE_CONFIGURATIONS[:s3]
details = JSON.parse(@response.body)
- assert_match /#{SERVICE_CONFIGURATIONS[:s3][:bucket]}\.s3.(\S+)?amazonaws\.com/, details["url"]
- assert_equal "hello.txt", GlobalID::Locator.locate_signed(details["sgid"]).filename.to_s
+ assert_match /#{SERVICE_CONFIGURATIONS[:s3][:bucket]}\.s3.(\S+)?amazonaws\.com/, details["upload_to_url"]
+ assert_equal "hello.txt", ActiveStorage::Blob.find_signed(details["signed_blob_id"]).filename.to_s
end
end
else
@@ -54,8 +54,8 @@ if SERVICE_CONFIGURATIONS[:gcs]
details = JSON.parse(@response.body)
- assert_match %r{storage\.googleapis\.com/#{@config[:bucket]}}, details["url"]
- assert_equal "hello.txt", GlobalID::Locator.locate_signed(details["sgid"]).filename.to_s
+ assert_match %r{storage\.googleapis\.com/#{@config[:bucket]}}, details["upload_to_url"]
+ assert_equal "hello.txt", ActiveStorage::Blob.find_signed(details["signed_blob_id"]).filename.to_s
end
end
else
diff --git a/test/controllers/variants_controller_test.rb b/test/controllers/variants_controller_test.rb
index d2b5c32df7..8d437bedbb 100644
--- a/test/controllers/variants_controller_test.rb
+++ b/test/controllers/variants_controller_test.rb
@@ -14,7 +14,7 @@ class ActiveStorage::VariantsControllerTest < ActionController::TestCase
test "showing variant inline" do
get :show, params: {
filename: @blob.filename,
- encoded_blob_key: ActiveStorage::VerifiedKeyWithExpiration.encode(@blob.key, expires_in: 5.minutes),
+ signed_blob_id: @blob.signed_id,
variation_key: ActiveStorage::Variation.encode(resize: "100x100") }
assert_redirected_to /racecar.jpg\?disposition=inline/
diff --git a/test/models/attachments_test.rb b/test/models/attachments_test.rb
index bfe631e5cb..c0f5db819d 100644
--- a/test/models/attachments_test.rb
+++ b/test/models/attachments_test.rb
@@ -21,7 +21,7 @@ class ActiveStorage::AttachmentsTest < ActiveSupport::TestCase
end
test "attach existing sgid blob" do
- @user.avatar.attach create_blob(filename: "funky.jpg").to_sgid.to_s
+ @user.avatar.attach create_blob(filename: "funky.jpg").signed_id
assert_equal "funky.jpg", @user.avatar.filename.to_s
end
diff --git a/test/models/blob_test.rb b/test/models/blob_test.rb
index 02fe653c33..ded11e5dbe 100644
--- a/test/models/blob_test.rb
+++ b/test/models/blob_test.rb
@@ -1,5 +1,6 @@
require "test_helper"
require "database/setup"
+require "active_storage/verified_key_with_expiration"
class ActiveStorage::BlobTest < ActiveSupport::TestCase
test "create after upload sets byte size and checksum" do
diff --git a/test/models/verified_key_with_expiration_test.rb b/test/models/verified_key_with_expiration_test.rb
index ee4dc7e02e..dd69e7cb10 100644
--- a/test/models/verified_key_with_expiration_test.rb
+++ b/test/models/verified_key_with_expiration_test.rb
@@ -1,5 +1,6 @@
require "test_helper"
require "active_support/core_ext/securerandom"
+require "active_storage/verified_key_with_expiration"
class ActiveStorage::VerifiedKeyWithExpirationTest < ActiveSupport::TestCase
FIXTURE_KEY = SecureRandom.base58(24)
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 1d9737c4a4..650e997205 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -28,11 +28,6 @@ require "tmpdir"
ActiveStorage::Blob.service = ActiveStorage::Service::DiskService.new(root: Dir.mktmpdir("active_storage_tests"))
ActiveStorage::Service.logger = ActiveSupport::Logger.new(STDOUT)
-require "active_storage/verified_key_with_expiration"
-ActiveStorage::VerifiedKeyWithExpiration.verifier = ActiveSupport::MessageVerifier.new("Testing")
-
-require "active_storage/variation"
-ActiveStorage::Variation.verifier = ActiveSupport::MessageVerifier.new("Testing")
ActiveStorage.verifier = ActiveSupport::MessageVerifier.new("Testing")
class ActiveSupport::TestCase
@@ -71,4 +66,3 @@ ActiveRecord::Base.send :extend, ActiveStorage::Attached::Macros
require "global_id"
GlobalID.app = "ActiveStorageExampleApp"
ActiveRecord::Base.send :include, GlobalID::Identification
-SignedGlobalID.verifier = ActiveStorage::VerifiedKeyWithExpiration.verifier