From 48327e462f6031db67a5b8df527d4f1776239d17 Mon Sep 17 00:00:00 2001 From: James Bence Date: Tue, 6 Aug 2013 16:46:03 -0700 Subject: [PATCH] Set up tests (and make them pass) for orderable_db_instance_options --- tests/aws/models/rds/instance_option_tests.rb | 14 +++++++++++ tests/aws/requests/rds/helper.rb | 22 ++++++++++++++++ .../aws/requests/rds/instance_option_tests.rb | 25 +++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 tests/aws/models/rds/instance_option_tests.rb create mode 100644 tests/aws/requests/rds/instance_option_tests.rb diff --git a/tests/aws/models/rds/instance_option_tests.rb b/tests/aws/models/rds/instance_option_tests.rb new file mode 100644 index 000000000..15d919a1f --- /dev/null +++ b/tests/aws/models/rds/instance_option_tests.rb @@ -0,0 +1,14 @@ +Shindo.tests("AWS::RDS | db instance options", ['aws', 'rds']) do + + params = {:engine => 'mysql'} + + pending if Fog.mocking? + + tests('#options') do + tests 'contains options' do + @instance = Fog::AWS[:rds].instance_options.new(params) + returns(true) { @instance.engine == 'mysql' } + end + end + +end diff --git a/tests/aws/requests/rds/helper.rb b/tests/aws/requests/rds/helper.rb index a78f99aa3..b41dee696 100644 --- a/tests/aws/requests/rds/helper.rb +++ b/tests/aws/requests/rds/helper.rb @@ -8,6 +8,11 @@ class AWS 'ResponseMetadata' => {'RequestId' => String} } + DB_AVAILABILITY_ZONE_OPTION = { + 'Name' => String, + 'ProvisionedIopsCapable' => Fog::Boolean + } + DB_PARAMETER_GROUP = { 'DBParameterGroupFamily' => String, 'DBParameterGroupName'=> String, @@ -79,6 +84,23 @@ class AWS } } + ORDERABLE_DB_INSTANCE_OPTION = { + 'MultiAZCapable' => Fog::Boolean, + 'Engine' => String, + 'LicenseModel' => String, + 'ReadReplicaCapable' => Fog::Boolean, + 'EngineVersion' => String, + 'AvailabilityZones' => [DB_AVAILABILITY_ZONE_OPTION], + 'DBInstanceClass' => String, + 'Vpc' => Fog::Boolean + } + + DESCRIBE_ORDERABLE_DB_INSTANCE_OPTION = BASIC.merge({ + 'DescribeOrderableDBInstanceOptionsResult' =>{ + 'OrderableDBInstanceOptions' => [ORDERABLE_DB_INSTANCE_OPTION] + } + }) + MODIFY_PARAMETER_GROUP = BASIC.merge({ 'ModifyDBParameterGroupResult' => { 'DBParameterGroupName' => String diff --git a/tests/aws/requests/rds/instance_option_tests.rb b/tests/aws/requests/rds/instance_option_tests.rb new file mode 100644 index 000000000..d84c4335b --- /dev/null +++ b/tests/aws/requests/rds/instance_option_tests.rb @@ -0,0 +1,25 @@ +Shindo.tests('AWS::RDS | db instance option requests', ['aws', 'rds']) do + tests('success') do + + tests("#describe_orderable_db_instance_options('mysql)").formats(AWS::RDS::Formats::DESCRIBE_ORDERABLE_DB_INSTANCE_OPTION) do + + body = Fog::AWS[:rds].describe_orderable_db_instance_options('mysql').body + + returns(100) {body['DescribeOrderableDBInstanceOptionsResult']['OrderableDBInstanceOptions'].length} + + group = body['DescribeOrderableDBInstanceOptionsResult']['OrderableDBInstanceOptions'].first + returns( true ) { group['MultiAZCapable'] } + returns( 'mysql' ) { group['Engine'] } + returns( true ) { group['ReadReplicaCapable'] } + returns( true ) { group['AvailabilityZones'].length >= 1 } + + body + end + + end + + tests("failures") do + raises(Fog::AWS::RDS::Error) {Fog::AWS[:rds].describe_orderable_db_instance_options('doesntexist')} + end + +end