From b26ad4f879c12932421cad5461bfb5f4784f6978 Mon Sep 17 00:00:00 2001 From: geemus Date: Sun, 23 May 2010 14:25:20 -0700 Subject: [PATCH] [ec2] convert region specs to shindo --- .../aws/requests/ec2/describe_regions_spec.rb | 21 ------------------- tests/aws/helper.rb | 8 +++++++ tests/aws/requests/ec2/region_tests.rb | 19 +++++++++++++++++ 3 files changed, 27 insertions(+), 21 deletions(-) delete mode 100644 spec/aws/requests/ec2/describe_regions_spec.rb create mode 100644 tests/aws/requests/ec2/region_tests.rb diff --git a/spec/aws/requests/ec2/describe_regions_spec.rb b/spec/aws/requests/ec2/describe_regions_spec.rb deleted file mode 100644 index 787679883..000000000 --- a/spec/aws/requests/ec2/describe_regions_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require File.dirname(__FILE__) + '/../../../spec_helper' - -describe 'EC2.describe_availability_zones' do - describe 'success' do - - it "should return proper attributes with no params" do - actual = AWS[:ec2].describe_regions - zone = actual.body['regionInfo'].first - zone['regionEndpoint'].should be_a(String) - zone['regionName'].should be_a(String) - end - - it "should return proper attribute with params" do - actual = AWS[:ec2].describe_regions(['us-east-1']) - zone = actual.body['regionInfo'].first - zone['regionEndpoint'].should be_a(String) - zone['regionName'].should be_a(String) - end - - end -end diff --git a/tests/aws/helper.rb b/tests/aws/helper.rb index 2363a55ec..34cc5a4dd 100644 --- a/tests/aws/helper.rb +++ b/tests/aws/helper.rb @@ -46,6 +46,14 @@ module AWS 'return' => ::Fog::Boolean } + REGIONS = { + 'regionInfo' => [{ + 'regionEndpoint' => String, + 'regionName' => String + }], + 'requestId' => String + } + SECURITY_GROUPS = { 'requestId' => String, 'securityGroupInfo' => [{ diff --git a/tests/aws/requests/ec2/region_tests.rb b/tests/aws/requests/ec2/region_tests.rb new file mode 100644 index 000000000..93b3b9f6e --- /dev/null +++ b/tests/aws/requests/ec2/region_tests.rb @@ -0,0 +1,19 @@ +Shindo.tests('AWS::EC2 | region requests', ['aws']) do + tests('success') do + + tests("#describe_regions").formats(AWS::EC2::Formats::REGIONS) do + AWS[:ec2].describe_regions.body + end + + tests("#describe_regions('us-east-1')").formats(AWS::EC2::Formats::REGIONS) do + AWS[:ec2].describe_regions('us-east-1').body + end + + end + tests('failure') do + + tests("#describe_regions('not-a-region')").raises(Excon::Errors::BadRequest) do + AWS[:ec2].describe_regions('not-a-region').body + end + end +end