aboutsummaryrefslogtreecommitdiffstats
path: root/test/sites
diff options
context:
space:
mode:
Diffstat (limited to 'test/sites')
-rw-r--r--test/sites/.gitignore1
-rw-r--r--test/sites/configurations-example.yml11
-rw-r--r--test/sites/disk_site_test.rb8
-rw-r--r--test/sites/gcs_site_test.rb11
-rw-r--r--test/sites/s3_site_test.rb11
-rw-r--r--test/sites/shared_site_tests.rb63
6 files changed, 0 insertions, 105 deletions
diff --git a/test/sites/.gitignore b/test/sites/.gitignore
deleted file mode 100644
index c102131f3d..0000000000
--- a/test/sites/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-configurations.yml
diff --git a/test/sites/configurations-example.yml b/test/sites/configurations-example.yml
deleted file mode 100644
index 031197342a..0000000000
--- a/test/sites/configurations-example.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copy this file to configurations.yml and edit the credentials to match your IAM test account and bucket
-s3:
- access_key_id:
- secret_access_key:
- region:
- bucket:
-
-gcs:
- project:
- keyfile:
- bucket:
diff --git a/test/sites/disk_site_test.rb b/test/sites/disk_site_test.rb
deleted file mode 100644
index 0956f08528..0000000000
--- a/test/sites/disk_site_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require "tmpdir"
-require "sites/shared_site_tests"
-
-class ActiveFile::Sites::DiskSiteTest < ActiveSupport::TestCase
- SITE = ActiveFile::Sites::DiskSite.new(root: File.join(Dir.tmpdir, "active_file"))
-
- include ActiveFile::Sites::SharedSiteTests
-end
diff --git a/test/sites/gcs_site_test.rb b/test/sites/gcs_site_test.rb
deleted file mode 100644
index fbf6c4a242..0000000000
--- a/test/sites/gcs_site_test.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require "sites/shared_site_tests"
-
-if SITE_CONFIGURATIONS[:gcs]
- class ActiveFile::Sites::GCSSiteTest < ActiveSupport::TestCase
- SITE = ActiveFile::Sites::GCSSite.new(SITE_CONFIGURATIONS[:gcs])
-
- include ActiveFile::Sites::SharedSiteTests
- end
-else
- puts "Skipping GCS Site tests because no GCS configuration was supplied"
-end
diff --git a/test/sites/s3_site_test.rb b/test/sites/s3_site_test.rb
deleted file mode 100644
index 12f5d084f6..0000000000
--- a/test/sites/s3_site_test.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require "sites/shared_site_tests"
-
-if SITE_CONFIGURATIONS[:s3]
- class ActiveFile::Sites::S3SiteTest < ActiveSupport::TestCase
- SITE = ActiveFile::Sites::S3Site.new(SITE_CONFIGURATIONS[:s3])
-
- include ActiveFile::Sites::SharedSiteTests
- end
-else
- puts "Skipping S3 Site tests because no S3 configuration was supplied"
-end
diff --git a/test/sites/shared_site_tests.rb b/test/sites/shared_site_tests.rb
deleted file mode 100644
index de28d7ae63..0000000000
--- a/test/sites/shared_site_tests.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-require "test_helper"
-require "active_support/core_ext/securerandom"
-require "yaml"
-
-SITE_CONFIGURATIONS = begin
- YAML.load_file(File.expand_path("../configurations.yml", __FILE__)).deep_symbolize_keys
-rescue Errno::ENOENT
- puts "Missing site configuration file in test/sites/configurations.yml"
-end
-
-module ActiveFile::Sites::SharedSiteTests
- extend ActiveSupport::Concern
-
- FIXTURE_KEY = SecureRandom.base58(24)
- FIXTURE_FILE = StringIO.new("Hello world!")
-
- included do
- setup do
- @site = self.class.const_get(:SITE)
- @site.upload FIXTURE_KEY, FIXTURE_FILE
- FIXTURE_FILE.rewind
- end
-
- teardown do
- @site.delete FIXTURE_KEY
- FIXTURE_FILE.rewind
- end
-
- test "uploading" do
- begin
- key = SecureRandom.base58(24)
- data = "Something else entirely!"
- @site.upload(key, StringIO.new(data))
-
- assert_equal data, @site.download(key)
- ensure
- @site.delete key
- end
- end
-
- test "downloading" do
- assert_equal FIXTURE_FILE.read, @site.download(FIXTURE_KEY)
- end
-
- test "existing" do
- assert @site.exist?(FIXTURE_KEY)
- assert_not @site.exist?(FIXTURE_KEY + "nonsense")
- end
-
- test "deleting" do
- @site.delete FIXTURE_KEY
- assert_not @site.exist?(FIXTURE_KEY)
- end
-
- test "sizing" do
- assert_equal FIXTURE_FILE.size, @site.byte_size(FIXTURE_KEY)
- end
-
- test "checksumming" do
- assert_equal Digest::MD5.hexdigest(FIXTURE_FILE.read), @site.checksum(FIXTURE_KEY)
- end
- end
-end