Skip to content

Commit

Permalink
Fixup nil_get_test
Browse files Browse the repository at this point in the history
- Enable for get methods with multiple parameters
- Mark as skip by default since fog#33 causes to leak info
  • Loading branch information
Temikus committed Jul 20, 2018
1 parent aaa65b2 commit b7d0500
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 20 deletions.
10 changes: 9 additions & 1 deletion test/helpers/test_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ def test_enumerable
end

def test_nil_get
assert_nil @subject.get(nil)
# Fixture for #33
skip
if @subject.method(:get).arity <= 1
assert_nil @subject.get(nil)
elsif @subject.method(:get).arity == 2
assert_nil @subject.get(nil)
else
fail "Unexpected number of required get parameters"
end
end

def teardown
Expand Down
2 changes: 1 addition & 1 deletion test/unit/compute/test_common_collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def setup
# Enumerate all descendants of Fog::Collection
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class).to_a

@collections = descendants.select {|d| d.name.match /Fog::Compute::Google/ } - exceptions
@collections = descendants.select { |d| d.name.match /Fog::Compute::Google/ } - exceptions
end

def teardown
Expand Down
16 changes: 8 additions & 8 deletions test/unit/compute/test_common_models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ def setup
@client = Fog::Compute.new(:provider => "Google", :google_project => "foo")

# Do not test models that do not have a create method in API
exceptions = [ Fog::Compute::Google::MachineType,
Fog::Compute::Google::Region,
Fog::Compute::Google::DiskType,
Fog::Compute::Google::Operation,
Fog::Compute::Google::Zone,
Fog::Compute::Google::Snapshot,
Fog::Compute::Google::Project ]
exceptions = [Fog::Compute::Google::MachineType,
Fog::Compute::Google::Region,
Fog::Compute::Google::DiskType,
Fog::Compute::Google::Operation,
Fog::Compute::Google::Zone,
Fog::Compute::Google::Snapshot,
Fog::Compute::Google::Project]
# Enumerate all descendants of Fog::Model
descendants = ObjectSpace.each_object(Fog::Model.singleton_class).to_a

@models = descendants.select {|d| d.name.match /Fog::Compute::Google/ } - exceptions
@models = descendants.select { |d| d.name.match /Fog::Compute::Google/ } - exceptions
end

def teardown
Expand Down
2 changes: 1 addition & 1 deletion test/unit/dns/test_common_collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def setup
# Enumerate all descendants of Fog::Collection
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)

@collections = descendants.select { |x| x.name.match /Fog::DNS::Google/ } - exceptions
@collections = descendants.select { |d| d.name.match /Fog::DNS::Google/ } - exceptions
end

def teardown
Expand Down
2 changes: 1 addition & 1 deletion test/unit/monitoring/test_comon_collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def setup
# Enumerate all descendants of Fog::Collection
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class).to_a

@collections = descendants.select { |x| x.name.match /Fog::Google::Monitoring/ } - exceptions
@collections = descendants.select { |d| d.name.match /Fog::Google::Monitoring/ } - exceptions
end

def teardown
Expand Down
2 changes: 1 addition & 1 deletion test/unit/pubsub/test_common_collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def setup
# Enumerate all descendants of Fog::Collection
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)

@collections = descendants.select { |x| x.name.match /Fog::Google::Pubsub/ } - exceptions
@collections = descendants.select { |d| d.name.match /Fog::Google::Pubsub/ } - exceptions
end

def teardown
Expand Down
2 changes: 1 addition & 1 deletion test/unit/sql/test_common_collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def setup
# Enumerate all descendants of Fog::Collection
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)

@collections = descendants.select { |x| x.name.match /Fog::Google::SQL/ } - exceptions
@collections = descendants.select { |d| d.name.match /Fog::Google::SQL/ } - exceptions
end

def teardown
Expand Down
6 changes: 3 additions & 3 deletions test/unit/storage/test_common_json_collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ def setup
# Enumerate all descendants of Fog::Collection
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)

@collections = descendants.select {
|x| x.name.match /Fog::Storage::GoogleJSON/
}
@collections = descendants.select do |d|
d.name.match /Fog::Storage::GoogleJSON/
end
end

def teardown
Expand Down
6 changes: 3 additions & 3 deletions test/unit/storage/test_common_xml_collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def setup
# Enumerate all descendants of Fog::Collection
descendants = ObjectSpace.each_object(Fog::Collection.singleton_class)

@collections = descendants.select {
|x| x.name.match /Fog::Storage::GoogleXML/
}
@collections = descendants.select do |d|
d.name.match /Fog::Storage::GoogleXML/
end
end

def teardown
Expand Down

0 comments on commit b7d0500

Please sign in to comment.