Also updates tests to match
---
lib/aeolus_cli/command/import_command.rb | 5 +++--
spec/command/import_command_spec.rb | 8 +-------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/lib/aeolus_cli/command/import_command.rb
b/lib/aeolus_cli/command/import_command.rb
index 9e740d3..dcce188 100644
--- a/lib/aeolus_cli/command/import_command.rb
+++ b/lib/aeolus_cli/command/import_command.rb
@@ -59,10 +59,11 @@ module Aeolus
raise ArgumentError, "params should not contain nil"
end
- required_keys = [:id, :target, :description, :provider_account]
+ required_keys = [:id, :provider_account]
+ optional_keys = [:description]
isect = params.keys & required_keys
- diff = params.keys - required_keys
+ diff = params.keys - required_keys - optional_keys
missing = required_keys - isect
diff --git a/spec/command/import_command_spec.rb b/spec/command/import_command_spec.rb
index 1e8c5ee..3a498ef 100644
--- a/spec/command/import_command_spec.rb
+++ b/spec/command/import_command_spec.rb
@@ -19,7 +19,6 @@ module Aeolus
describe ImportCommand do
let( :description ) {
"<image><name>MyImage</name></image>" }
let( :options ) { { :id => "ami-5592553c",
- :target => ["ec2"],
:provider_account => ["ec2-us-east-1"],
:description => description } }
let( :importc ) { ImportCommand.new( options ) }
@@ -27,7 +26,6 @@ module Aeolus
describe "#import_image" do
context "without description parameter" do
let( :options ) { { :id => "ami-5592553c",
- :target => ["ec2"],
:provider_account => ["ec2-us-east-1"] } }
it "should import an image with default description value" do
@@ -146,7 +144,6 @@ module Aeolus
subject { lambda { importc.send( :import_params_valid!, params ) } }
context "correct params" do
let( :params ) { { :id => "ami-5592553c",
- :target => ["ec2"],
:provider_account => ["ec2-us-east-1"],
:description => description } }
it { subject.call.should be_true }
@@ -154,14 +151,12 @@ module Aeolus
context "missing parameter" do
let( :params ) { { :id => "ami-5592553c",
- :provider_account => ["ec2-us-east-1"],
:description => description } }
it { should raise_error(ArgumentError, /missing/) }
end
context "unexpected parameter" do
let( :params ) { { :id => "ami-5592553c",
- :target => ["ec2"],
:provider_account => ["ec2-us-east-1"],
:other_parameter => "other_value",
:description => description } }
@@ -170,9 +165,8 @@ module Aeolus
context "any parameter is nil" do
let( :params ) { { :id => "ami-5592553c",
- :target => nil,
:provider_account => ["ec2-us-east-1"],
- :other_parameter => "other_value",
+ :other_parameter => nil,
:description => description } }
it { should raise_error(ArgumentError, /params should not contain nil/) }
end
--
1.7.6.4