1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Update mocks and tests to simulate real results.

This commit is contained in:
Rupak Ganguly 2012-04-10 14:57:11 -04:00
parent e54573070e
commit b997218f93
2 changed files with 9 additions and 5 deletions

View file

@ -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

View file

@ -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')