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:
parent
e54573070e
commit
b997218f93
2 changed files with 9 additions and 5 deletions
|
@ -50,6 +50,10 @@ module Fog
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def create_security_group(name, description)
|
def create_security_group(name, description)
|
||||||
|
# all spaces are removed
|
||||||
|
name = name.strip!
|
||||||
|
description = description.strip!
|
||||||
|
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
if self.data[:security_groups].detect {|_,v| v['name'] == name}
|
if self.data[:security_groups].detect {|_,v| v['name'] == name}
|
||||||
response.status = 400
|
response.status = 400
|
||||||
|
|
|
@ -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)
|
model_tests(Fog::Compute[:hp].security_groups, {:name => 'foggroupname', :description => 'foggroupdescription'}, true)
|
||||||
|
|
||||||
tests("a group with trailing whitespace") do
|
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
|
test("all spaces are removed from name") do
|
||||||
@group.name == "foggroup with spaces "
|
@group.name == " foggroup with spaces ".strip!
|
||||||
end
|
end
|
||||||
|
|
||||||
test("description is correct") do
|
test("all spaces are removed from description") do
|
||||||
@group.description == " fog group desc "
|
@group.description == " fog group desc ".strip!
|
||||||
end
|
end
|
||||||
|
|
||||||
@other_group = Fog::Compute[:hp].security_groups.create(:name => 'other group', :description => 'another group')
|
@other_group = Fog::Compute[:hp].security_groups.create(:name => 'other group', :description => 'another group')
|
||||||
|
|
Loading…
Add table
Reference in a new issue