diff --git a/lib/fog/hp/requests/compute/create_security_group.rb b/lib/fog/hp/requests/compute/create_security_group.rb index cd1e6d7a6..2593eebcb 100644 --- a/lib/fog/hp/requests/compute/create_security_group.rb +++ b/lib/fog/hp/requests/compute/create_security_group.rb @@ -50,6 +50,10 @@ module Fog class Mock def create_security_group(name, description) + # all spaces are removed + name = name.strip! + description = description.strip! + response = Excon::Response.new if self.data[:security_groups].detect {|_,v| v['name'] == name} response.status = 400 diff --git a/tests/hp/models/compute/security_group_tests.rb b/tests/hp/models/compute/security_group_tests.rb index 6e4876fdf..43582cb79 100644 --- a/tests/hp/models/compute/security_group_tests.rb +++ b/tests/hp/models/compute/security_group_tests.rb @@ -3,14 +3,14 @@ Shindo.tests("Fog::Compute[:hp] | security_group", ['hp']) do model_tests(Fog::Compute[:hp].security_groups, {:name => 'foggroupname', :description => 'foggroupdescription'}, true) tests("a group with trailing whitespace") do - @group = Fog::Compute[:hp].security_groups.create(:name => "foggroup with spaces ", :description => " fog group desc ") + @group = Fog::Compute[:hp].security_groups.create(:name => " foggroup with spaces ", :description => " fog group desc ") - test("name is correct") do - @group.name == "foggroup with spaces " + test("all spaces are removed from name") do + @group.name == " foggroup with spaces ".strip! end - test("description is correct") do - @group.description == " fog group desc " + test("all spaces are removed from description") do + @group.description == " fog group desc ".strip! end @other_group = Fog::Compute[:hp].security_groups.create(:name => 'other group', :description => 'another group')