fog-google 1.25.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/integration-compute-core.yml +2 -2
- data/.github/workflows/integration-compute-instance_groups.yml +2 -2
- data/.github/workflows/integration-compute-loadbalancing.yml +2 -2
- data/.github/workflows/integration-compute-networking.yml +2 -2
- data/.github/workflows/integration-monitoring.yml +2 -2
- data/.github/workflows/integration-pubsub.yml +2 -2
- data/.github/workflows/integration-sql.yml +2 -2
- data/.github/workflows/integration-storage.yml +2 -2
- data/.github/workflows/unit.yml +2 -2
- data/CHANGELOG.md +46 -27
- data/SECURITY.md +3 -14
- data/fog-google.gemspec +2 -3
- data/lib/fog/google/compute/models/server.rb +1 -1
- data/lib/fog/google/storage/storage_json/real.rb +4 -2
- data/lib/fog/google/storage/storage_json/utils.rb +4 -2
- data/lib/fog/google/storage/storage_xml/real.rb +4 -2
- data/lib/fog/google/storage/storage_xml/requests/get_bucket.rb +1 -1
- data/lib/fog/google/storage/storage_xml/utils.rb +4 -2
- data/lib/fog/google/version.rb +1 -1
- metadata +5 -198
- data/.github/workflows/stale.yml +0 -23
- data/test/helpers/client_helper.rb +0 -63
- data/test/helpers/integration_test_helper.rb +0 -108
- data/test/helpers/test_collection.rb +0 -60
- data/test/helpers/test_helper.rb +0 -28
- data/test/integration/compute/core_compute/test_client_options.rb +0 -12
- data/test/integration/compute/core_compute/test_coverage.rb +0 -6
- data/test/integration/compute/core_compute/test_disk_types.rb +0 -43
- data/test/integration/compute/core_compute/test_disks.rb +0 -53
- data/test/integration/compute/core_compute/test_images.rb +0 -32
- data/test/integration/compute/core_compute/test_machine_types.rb +0 -55
- data/test/integration/compute/core_compute/test_operations.rb +0 -45
- data/test/integration/compute/core_compute/test_projects.rb +0 -19
- data/test/integration/compute/core_compute/test_regions.rb +0 -33
- data/test/integration/compute/core_compute/test_servers.rb +0 -235
- data/test/integration/compute/core_compute/test_snapshots.rb +0 -21
- data/test/integration/compute/core_compute/test_zones.rb +0 -35
- data/test/integration/compute/core_networking/test_addresses.rb +0 -107
- data/test/integration/compute/core_networking/test_coverage.rb +0 -6
- data/test/integration/compute/core_networking/test_firewalls.rb +0 -11
- data/test/integration/compute/core_networking/test_networks.rb +0 -30
- data/test/integration/compute/core_networking/test_routes.rb +0 -26
- data/test/integration/compute/core_networking/test_subnetworks.rb +0 -11
- data/test/integration/compute/instance_groups/test_coverage.rb +0 -6
- data/test/integration/compute/instance_groups/test_instance_group_managers.rb +0 -11
- data/test/integration/compute/instance_groups/test_instance_groups.rb +0 -11
- data/test/integration/compute/instance_groups/test_instance_templates.rb +0 -11
- data/test/integration/compute/loadbalancing/test_backend_services.rb +0 -11
- data/test/integration/compute/loadbalancing/test_coverage.rb +0 -6
- data/test/integration/compute/loadbalancing/test_forwarding_rules.rb +0 -11
- data/test/integration/compute/loadbalancing/test_global_addresses.rb +0 -11
- data/test/integration/compute/loadbalancing/test_global_forwarding_rules.rb +0 -11
- data/test/integration/compute/loadbalancing/test_http_health_checks.rb +0 -11
- data/test/integration/compute/loadbalancing/test_ssl_certificates.rb +0 -11
- data/test/integration/compute/loadbalancing/test_target_http_proxies.rb +0 -11
- data/test/integration/compute/loadbalancing/test_target_https_proxies.rb +0 -11
- data/test/integration/compute/loadbalancing/test_target_instances.rb +0 -11
- data/test/integration/compute/loadbalancing/test_target_pools.rb +0 -55
- data/test/integration/compute/loadbalancing/test_url_maps.rb +0 -11
- data/test/integration/factories/addresses_factory.rb +0 -20
- data/test/integration/factories/backend_services_factory.rb +0 -19
- data/test/integration/factories/collection_factory.rb +0 -52
- data/test/integration/factories/disks_factory.rb +0 -22
- data/test/integration/factories/firewalls_factory.rb +0 -13
- data/test/integration/factories/forwarding_rules_factory.rb +0 -25
- data/test/integration/factories/global_addresses_factory.rb +0 -15
- data/test/integration/factories/global_forwarding_rules_factory.rb +0 -20
- data/test/integration/factories/http_health_checks_factory.rb +0 -11
- data/test/integration/factories/images_factory.rb +0 -16
- data/test/integration/factories/instance_group_manager_factory.rb +0 -30
- data/test/integration/factories/instance_groups_factory.rb +0 -20
- data/test/integration/factories/instance_template_factory.rb +0 -24
- data/test/integration/factories/networks_factory.rb +0 -14
- data/test/integration/factories/servers_factory.rb +0 -30
- data/test/integration/factories/sql_certs_factory.rb +0 -20
- data/test/integration/factories/sql_instances_factory.rb +0 -19
- data/test/integration/factories/sql_users_factory.rb +0 -23
- data/test/integration/factories/ssl_certificates_factory.rb +0 -13
- data/test/integration/factories/subnetworks_factory.rb +0 -26
- data/test/integration/factories/target_http_proxies_factory.rb +0 -19
- data/test/integration/factories/target_https_proxies_factory.rb +0 -26
- data/test/integration/factories/target_instances_factory.rb +0 -24
- data/test/integration/factories/target_pools_factory.rb +0 -28
- data/test/integration/factories/url_maps_factory.rb +0 -19
- data/test/integration/monitoring/test_coverage.rb +0 -6
- data/test/integration/monitoring/test_metric_descriptors.rb +0 -131
- data/test/integration/monitoring/test_monitored_resource_descriptors.rb +0 -37
- data/test/integration/monitoring/test_timeseries.rb +0 -253
- data/test/integration/pubsub/pubsub_shared.rb +0 -75
- data/test/integration/pubsub/test_coverage.rb +0 -6
- data/test/integration/pubsub/test_pubsub_models.rb +0 -135
- data/test/integration/pubsub/test_pubsub_requests.rb +0 -105
- data/test/integration/sql/test_certs.rb +0 -50
- data/test/integration/sql/test_common_flags.rb +0 -31
- data/test/integration/sql/test_common_tiers.rb +0 -26
- data/test/integration/sql/test_coverage.rb +0 -6
- data/test/integration/sql/test_instances.rb +0 -101
- data/test/integration/sql/test_users.rb +0 -37
- data/test/integration/storage/storage_shared.rb +0 -101
- data/test/integration/storage/test_buckets.rb +0 -112
- data/test/integration/storage/test_coverage.rb +0 -6
- data/test/integration/storage/test_directories.rb +0 -67
- data/test/integration/storage/test_files.rb +0 -168
- data/test/integration/storage/test_objects.rb +0 -226
- data/test/integration/test_authentication.rb +0 -38
- data/test/unit/compute/test_common_collections.rb +0 -42
- data/test/unit/compute/test_common_models.rb +0 -35
- data/test/unit/compute/test_disk.rb +0 -26
- data/test/unit/compute/test_server.rb +0 -29
- data/test/unit/dns/test_common_collections.rb +0 -43
- data/test/unit/monitoring/test_comon_collections.rb +0 -44
- data/test/unit/pubsub/test_common_collections.rb +0 -35
- data/test/unit/sql/test_common_collections.rb +0 -46
- data/test/unit/storage/test_common_json_collections.rb +0 -38
- data/test/unit/storage/test_common_xml_collections.rb +0 -50
- data/test/unit/storage/test_json_requests.rb +0 -60
- data/test/unit/storage/test_xml_requests.rb +0 -60
@@ -1,26 +0,0 @@
|
|
1
|
-
require "helpers/test_helper"
|
2
|
-
|
3
|
-
class UnitTestDisk < Minitest::Test
|
4
|
-
def setup
|
5
|
-
Fog.mock!
|
6
|
-
@client = Fog::Compute.new(provider: "google",
|
7
|
-
google_project: "foo")
|
8
|
-
end
|
9
|
-
|
10
|
-
def teardown
|
11
|
-
Fog.unmock!
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_new_disk
|
15
|
-
disk = Fog::Google::Compute::Disk.new(
|
16
|
-
:name => "fog-1",
|
17
|
-
:size_gb => 10,
|
18
|
-
:zone => "us-central1-a",
|
19
|
-
:source_image => "debian-7-wheezy-v20131120"
|
20
|
-
)
|
21
|
-
assert_equal("fog-1", disk.name, "Fog::Google::Compute::Disk name is incorrect: #{disk.name}")
|
22
|
-
assert_equal(10, disk.size_gb, "Fog::Google::Compute::Disk size_gb is incorrect: #{disk.size_gb}")
|
23
|
-
assert_equal("us-central1-a", disk.zone, "Fog::Google::Compute::Disk zone is incorrect: #{disk.zone}")
|
24
|
-
assert_equal("debian-7-wheezy-v20131120", disk.source_image, "Fog::Google::Compute::Disk source_image is incorrect: #{disk.source_image}")
|
25
|
-
end
|
26
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require "helpers/test_helper"
|
2
|
-
|
3
|
-
class UnitTestServer < Minitest::Test
|
4
|
-
def setup
|
5
|
-
Fog.mock!
|
6
|
-
@client = Fog::Compute.new(provider: "google",
|
7
|
-
google_project: "foo")
|
8
|
-
end
|
9
|
-
|
10
|
-
def teardown
|
11
|
-
Fog.unmock!
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_if_server_accepts_ssh_keys
|
15
|
-
key = "ssh-rsa IAMNOTAREALSSHKEYAMA== user@host.subdomain.example.com"
|
16
|
-
|
17
|
-
File.stub :read, key do
|
18
|
-
server = Fog::Google::Compute::Server.new(
|
19
|
-
:name => "foo",
|
20
|
-
:machine_type => "bar",
|
21
|
-
:disks => ["baz"],
|
22
|
-
:zone => "foo",
|
23
|
-
:public_key_path => key
|
24
|
-
)
|
25
|
-
assert_equal(server.public_key, key,
|
26
|
-
"Fog::Google::Compute::Server loads public_key properly")
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require "helpers/test_helper"
|
2
|
-
|
3
|
-
class UnitTestDNSCollections < Minitest::Test
|
4
|
-
def setup
|
5
|
-
Fog.mock!
|
6
|
-
@client = Fog::DNS.new(provider: "google",
|
7
|
-
google_project: "foo")
|
8
|
-
|
9
|
-
# Exceptions that do not pass test_common_methods:
|
10
|
-
#
|
11
|
-
# DNS Projects API does not support 'list', so 'all' method is not possible
|
12
|
-
@common_methods_exceptions = [Fog::Google::DNS::Projects]
|
13
|
-
# Enumerate all descendants of Fog::Collection
|
14
|
-
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)
|
15
|
-
|
16
|
-
@collections = descendants.select { |d| d.name.match(/Fog::Google::DNS/) }
|
17
|
-
end
|
18
|
-
|
19
|
-
def teardown
|
20
|
-
Fog.unmock!
|
21
|
-
end
|
22
|
-
|
23
|
-
# This tests whether Fog::Google::Compute collections have common lifecycle methods
|
24
|
-
def test_common_methods
|
25
|
-
subjects = @collections - @common_methods_exceptions
|
26
|
-
subjects.each do |klass|
|
27
|
-
obj = klass.new
|
28
|
-
assert obj.respond_to?(:all), "#{klass} should have an .all method"
|
29
|
-
assert obj.respond_to?(:get), "#{klass} should have a .get method"
|
30
|
-
assert obj.respond_to?(:each), "#{klass} should behave like Enumerable"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_collection_get_arguments
|
35
|
-
# TODO: Fixture for #352
|
36
|
-
skip
|
37
|
-
@collections.each do |klass|
|
38
|
-
obj = klass.new
|
39
|
-
assert_operator(obj.method(:get).arity, :<=, 1,
|
40
|
-
"#{klass} should have at most 1 required parameter in get()")
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require "helpers/test_helper"
|
2
|
-
|
3
|
-
class UnitTestMonitoringCollections < Minitest::Test
|
4
|
-
def setup
|
5
|
-
Fog.mock!
|
6
|
-
@client = Fog::Monitoring.new(provider: "google",
|
7
|
-
google_project: "foo")
|
8
|
-
|
9
|
-
# Exceptions that do not pass test_common_methods:
|
10
|
-
#
|
11
|
-
# TimeSeries API has no 'get' method
|
12
|
-
@common_method_exceptions = [Fog::Google::Monitoring::TimeseriesCollection]
|
13
|
-
# Enumerate all descendants of Fog::Collection
|
14
|
-
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class).to_a
|
15
|
-
|
16
|
-
@collections = descendants.select { |d| d.name.match(/Fog::Google::Monitoring/) }
|
17
|
-
end
|
18
|
-
|
19
|
-
def teardown
|
20
|
-
Fog.unmock!
|
21
|
-
end
|
22
|
-
|
23
|
-
# This tests whether Fog::Google::Compute collections have common lifecycle methods
|
24
|
-
def test_common_methods
|
25
|
-
subjects = @collections - @common_method_exceptions
|
26
|
-
|
27
|
-
subjects.each do |klass|
|
28
|
-
obj = klass.new
|
29
|
-
assert obj.respond_to?(:all), "#{klass} should have an .all method"
|
30
|
-
assert obj.respond_to?(:get), "#{klass} should have a .get method"
|
31
|
-
assert obj.respond_to?(:each), "#{klass} should behave like Enumerable"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_collection_get_arguments
|
36
|
-
@collections.each do |klass|
|
37
|
-
obj = klass.new
|
38
|
-
if obj.respond_to?(:get)
|
39
|
-
assert_operator(obj.method(:get).arity, :<=, 1,
|
40
|
-
"#{klass} should have at most 1 required parameter in get()")
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require "helpers/test_helper"
|
2
|
-
|
3
|
-
class UnitTestPubsubCollections < Minitest::Test
|
4
|
-
def setup
|
5
|
-
Fog.mock!
|
6
|
-
@client = Fog::Google::Pubsub.new(google_project: "foo")
|
7
|
-
|
8
|
-
# Enumerate all descendants of Fog::Collection
|
9
|
-
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)
|
10
|
-
|
11
|
-
@collections = descendants.select { |d| d.name.match(/Fog::Google::Pubsub/) }
|
12
|
-
end
|
13
|
-
|
14
|
-
def teardown
|
15
|
-
Fog.unmock!
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_common_methods
|
19
|
-
# This tests whether Fog::Google::Compute collections have common lifecycle methods
|
20
|
-
@collections.each do |klass|
|
21
|
-
obj = klass.new
|
22
|
-
assert obj.respond_to?(:all), "#{klass} should have an .all method"
|
23
|
-
assert obj.respond_to?(:get), "#{klass} should have a .get method"
|
24
|
-
assert obj.respond_to?(:each), "#{klass} should behave like Enumerable"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_collection_get_arguments
|
29
|
-
@collections.each do |klass|
|
30
|
-
obj = klass.new
|
31
|
-
assert_operator(obj.method(:get).arity, :<=, 1,
|
32
|
-
"#{klass} should have at most 1 required parameter in get()")
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require "helpers/test_helper"
|
2
|
-
|
3
|
-
class UnitTestSQLCollections < Minitest::Test
|
4
|
-
def setup
|
5
|
-
Fog.mock!
|
6
|
-
@client = Fog::Google::SQL.new(google_project: "foo")
|
7
|
-
|
8
|
-
# Exceptions that do not pass test_common_methods:
|
9
|
-
#
|
10
|
-
# SQL Users API doesn't have a 'get' method
|
11
|
-
# SQL Flags API has only one method - 'list'
|
12
|
-
# SQL Tiers API has only one method - 'list'
|
13
|
-
@common_method_exceptions = [Fog::Google::SQL::Users,
|
14
|
-
Fog::Google::SQL::Tiers,
|
15
|
-
Fog::Google::SQL::Flags]
|
16
|
-
# Enumerate all descendants of Fog::Collection
|
17
|
-
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)
|
18
|
-
|
19
|
-
@collections = descendants.select { |d| d.name.match(/Fog::Google::SQL/) }
|
20
|
-
end
|
21
|
-
|
22
|
-
def teardown
|
23
|
-
Fog.unmock!
|
24
|
-
end
|
25
|
-
|
26
|
-
# This tests whether Fog::Google::Compute collections have common lifecycle methods
|
27
|
-
def test_common_methods
|
28
|
-
subjects = @collections - @common_method_exceptions
|
29
|
-
subjects.each do |klass|
|
30
|
-
obj = klass.new
|
31
|
-
assert obj.respond_to?(:all), "#{klass} should have an .all method"
|
32
|
-
assert obj.respond_to?(:get), "#{klass} should have a .get method"
|
33
|
-
assert obj.respond_to?(:each), "#{klass} should behave like Enumerable"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_collection_get_arguments
|
38
|
-
# TODO: Fixture for #352
|
39
|
-
skip
|
40
|
-
@collections.each do |klass|
|
41
|
-
obj = klass.new
|
42
|
-
assert_operator(obj.method(:get).arity, :<=, 1,
|
43
|
-
"#{klass} should have at most 1 required parameter in get()")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require "helpers/test_helper"
|
2
|
-
|
3
|
-
class UnitTestStorageJSONCollections < Minitest::Test
|
4
|
-
def setup
|
5
|
-
Fog.mock!
|
6
|
-
@client = Fog::Storage.new(provider: "google",
|
7
|
-
google_project: "foo")
|
8
|
-
|
9
|
-
# Enumerate all descendants of Fog::Collection
|
10
|
-
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)
|
11
|
-
|
12
|
-
@collections = descendants.select do |d|
|
13
|
-
d.name.match(/Fog::Google::StorageJSON/)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def teardown
|
18
|
-
Fog.unmock!
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_common_methods
|
22
|
-
# This tests whether Fog::Google::Compute collections have common lifecycle methods
|
23
|
-
@collections.each do |klass|
|
24
|
-
obj = klass.new
|
25
|
-
assert obj.respond_to?(:all), "#{klass} should have an .all method"
|
26
|
-
assert obj.respond_to?(:get), "#{klass} should have a .get method"
|
27
|
-
assert obj.respond_to?(:each), "#{klass} should behave like Enumerable"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_collection_get_arguments
|
32
|
-
@collections.each do |klass|
|
33
|
-
obj = klass.new
|
34
|
-
assert_operator(obj.method(:get).arity, :<=, 1,
|
35
|
-
"#{klass} should have at most 1 required parameter in get()")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require "helpers/test_helper"
|
2
|
-
|
3
|
-
class UnitTestStorageXMLCollections < Minitest::Test
|
4
|
-
def setup
|
5
|
-
Fog.mock!
|
6
|
-
@client = Fog::Storage.new(provider: "google",
|
7
|
-
google_storage_access_key_id: "",
|
8
|
-
google_storage_secret_access_key: "")
|
9
|
-
@bucket = @client.directories.create(key: "testbucket-#{SecureRandom.hex}")
|
10
|
-
|
11
|
-
# Enumerate all descendants of Fog::Collection
|
12
|
-
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)
|
13
|
-
|
14
|
-
@collections = descendants.select do |d|
|
15
|
-
d.name.match(/Fog::Google::StorageXML/)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def teardown
|
20
|
-
Fog.unmock!
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_common_methods
|
24
|
-
# This tests whether Fog::Google::Compute collections have common lifecycle methods
|
25
|
-
@collections.each do |klass|
|
26
|
-
obj = klass.new
|
27
|
-
assert obj.respond_to?(:all), "#{klass} should have an .all method"
|
28
|
-
assert obj.respond_to?(:get), "#{klass} should have a .get method"
|
29
|
-
assert obj.respond_to?(:each), "#{klass} should behave like Enumerable"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_collection_get_arguments
|
34
|
-
@collections.each do |klass|
|
35
|
-
obj = klass.new
|
36
|
-
assert_operator(obj.method(:get).arity, :<=, 1,
|
37
|
-
"#{klass} should have at most 1 required parameter in get()")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_metadata
|
42
|
-
attr = { key: "test-file", body: "hello world\x00" }
|
43
|
-
f = @bucket.files.new(attr)
|
44
|
-
assert_equal({}, f.metadata)
|
45
|
-
|
46
|
-
metadata = { "x-goog-meta-my-header" => "hello world" }
|
47
|
-
f = @bucket.files.new(attr.merge(metadata))
|
48
|
-
assert_equal(metadata, f.metadata)
|
49
|
-
end
|
50
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
require "helpers/test_helper"
|
2
|
-
|
3
|
-
class UnitTestJsonRequests < Minitest::Test
|
4
|
-
def setup
|
5
|
-
Fog.mock!
|
6
|
-
@client = Fog::Storage.new(provider: "google",
|
7
|
-
google_project: "",
|
8
|
-
google_json_key_location: "")
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
Fog.unmock!
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_get_url_path_has_query_params
|
16
|
-
url = @client.get_object_url("bucket",
|
17
|
-
"just some file.json",
|
18
|
-
Time.now + 2 * 60,
|
19
|
-
query: { "projection" => 'full, noAcl"' })
|
20
|
-
|
21
|
-
assert_match(/projection=full%2C%20noAcl/, url,
|
22
|
-
"query string should be escaped")
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_get_url_filter_nil_query_params
|
26
|
-
url = @client.get_object_url("bucket",
|
27
|
-
"just some file.json",
|
28
|
-
Time.now + 2 * 60,
|
29
|
-
query: { "projection" => nil })
|
30
|
-
|
31
|
-
refute_match(/projection/, url,
|
32
|
-
"nil query params should be omitted")
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_put_url_path_is_properly_escaped
|
36
|
-
url = @client.put_object_url("bucket",
|
37
|
-
"just some file.json",
|
38
|
-
Time.now + 2 * 60,
|
39
|
-
"Content-Type" => "application/json")
|
40
|
-
|
41
|
-
assert_match(/just%20some%20file\.json/, url,
|
42
|
-
"space should be escaped with '%20'")
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_unescaped_slashes_in_url
|
46
|
-
url = @client.get_object_https_url("bucket",
|
47
|
-
"a/b/c.ext",
|
48
|
-
Time.now + 2 * 60)
|
49
|
-
assert_match(/a\/b\/c/, url,
|
50
|
-
"slashes should not be escaped with '%2F'")
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_unescaped_pluses_in_url
|
54
|
-
url = @client.get_object_https_url("bucket",
|
55
|
-
"a+c.ext",
|
56
|
-
Time.now + 2 * 60)
|
57
|
-
assert_match(/a\+c/, url,
|
58
|
-
"pluses should not be escaped with '%2B'")
|
59
|
-
end
|
60
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
require "helpers/test_helper"
|
2
|
-
|
3
|
-
class UnitTestXMLRequests < Minitest::Test
|
4
|
-
def setup
|
5
|
-
Fog.mock!
|
6
|
-
@client = Fog::Storage.new(provider: "google",
|
7
|
-
google_storage_access_key_id: "",
|
8
|
-
google_storage_secret_access_key: "")
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
Fog.unmock!
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_get_http_url
|
16
|
-
url = @client.get_object_http_url("bucket",
|
17
|
-
"just some file.json",
|
18
|
-
Time.now + 2 * 60)
|
19
|
-
assert_match(/^http:\/\//, url,
|
20
|
-
"URL starts with HTTP")
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_get_https_url
|
24
|
-
url = @client.get_object_https_url("bucket",
|
25
|
-
"just some file.json",
|
26
|
-
Time.now + 2 * 60)
|
27
|
-
assert_match(/^https:\/\//, url,
|
28
|
-
"URL starts with HTTPS")
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_get_url_path_has_query_params
|
32
|
-
url = @client.get_object_url("bucket",
|
33
|
-
"just some file.json",
|
34
|
-
Time.now + 2 * 60,
|
35
|
-
query: { "Response-Content-Disposition" => 'inline; filename="test.json"' })
|
36
|
-
|
37
|
-
assert_match(/Response-Content-Disposition=inline%3B%20filename%3D%22test.json/, url,
|
38
|
-
"query string should be escaped")
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_get_url_filter_nil_query_params
|
42
|
-
url = @client.get_object_url("bucket",
|
43
|
-
"just some file.json",
|
44
|
-
Time.now + 2 * 60,
|
45
|
-
query: { "Response-Content-Disposition" => nil })
|
46
|
-
|
47
|
-
refute_match(/Response-Content-Disposition/, url,
|
48
|
-
"nil query params should be omitted")
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_put_url_path_is_properly_escaped
|
52
|
-
url = @client.put_object_url("bucket",
|
53
|
-
"just some file.json",
|
54
|
-
Time.now + 2 * 60,
|
55
|
-
"Content-Type" => "application/json")
|
56
|
-
|
57
|
-
assert_match(/just%20some%20file\.json/, url,
|
58
|
-
"space should be escaped with '%20'")
|
59
|
-
end
|
60
|
-
end
|