diff --git a/lib/fog/aws/requests/compute/modify_image_attribute.rb b/lib/fog/aws/requests/compute/modify_image_attribute.rb index f8bd0606f..bea1ae835 100644 --- a/lib/fog/aws/requests/compute/modify_image_attribute.rb +++ b/lib/fog/aws/requests/compute/modify_image_attribute.rb @@ -20,6 +20,8 @@ module Fog # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html] # def modify_image_attribute(image_id, attributes) + raise ArgumentError.new("image_id is required") unless image_id + params = {} params.merge!(Fog::AWS.indexed_param('LaunchPermission.Add.%d.Group', attributes['Add.Group'] || [])) params.merge!(Fog::AWS.indexed_param('LaunchPermission.Add.%d.UserId', attributes['Add.UserId'] || [])) diff --git a/tests/aws/requests/compute/image_tests.rb b/tests/aws/requests/compute/image_tests.rb index 4faeb8b09..c568ae941 100644 --- a/tests/aws/requests/compute/image_tests.rb +++ b/tests/aws/requests/compute/image_tests.rb @@ -65,4 +65,12 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do end end end + + tests('failure') do + pending if Fog.mocking? + + tests("#modify_image_attribute(nil, { 'Add.Group' => ['all'] })").raises(ArgumentError) do + Fog::Compute[:aws].modify_image_attribute(nil, { 'Add.Group' => ['all'] }).body + end + end end