1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/tests/requests/rds/parameter_group_tests.rb
2015-01-02 09:42:20 -08:00

62 lines
2.4 KiB
Ruby

Shindo.tests('AWS::RDS | parameter group requests', ['aws', 'rds']) do
tests('success') do
tests("#create_db_parameter_groups").formats(AWS::RDS::Formats::CREATE_DB_PARAMETER_GROUP) do
body = Fog::AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description').body
returns( 'mysql5.1') { body['CreateDBParameterGroupResult']['DBParameterGroup']['DBParameterGroupFamily']}
returns( 'fog-group') { body['CreateDBParameterGroupResult']['DBParameterGroup']['DBParameterGroupName']}
returns( 'Some description') { body['CreateDBParameterGroupResult']['DBParameterGroup']['Description']}
body
end
Fog::AWS[:rds].create_db_parameter_group('other-fog-group', 'MySQL5.1', 'Some description')
tests("#describe_db_parameter_groups").formats(AWS::RDS::Formats::DESCRIBE_DB_PARAMETER_GROUP) do
body = Fog::AWS[:rds].describe_db_parameter_groups().body
returns(4) {body['DescribeDBParameterGroupsResult']['DBParameterGroups'].length}
body
end
tests("#describe_db_parameter_groups('fog-group)").formats(AWS::RDS::Formats::DESCRIBE_DB_PARAMETER_GROUP) do
body = Fog::AWS[:rds].describe_db_parameter_groups('fog-group').body
returns(1) {body['DescribeDBParameterGroupsResult']['DBParameterGroups'].length}
group = body['DescribeDBParameterGroupsResult']['DBParameterGroups'].first
returns( 'mysql5.1') { group['DBParameterGroupFamily']}
returns( 'fog-group') { group['DBParameterGroupName']}
returns( 'Some description') { group['Description']}
body
end
tests("delete_db_parameter_group").formats(AWS::RDS::Formats::BASIC) do
body = Fog::AWS[:rds].delete_db_parameter_group('fog-group').body
raises(Fog::AWS::RDS::NotFound) {Fog::AWS[:rds].describe_db_parameter_groups('fog-group')}
body
end
Fog::AWS[:rds].delete_db_parameter_group('other-fog-group')
end
tests("failures") do
raises(Fog::AWS::RDS::NotFound) {Fog::AWS[:rds].describe_db_parameter_groups('doesntexist')}
raises(Fog::AWS::RDS::NotFound) {Fog::AWS[:rds].delete_db_parameter_group('doesntexist')}
tests "creating second group with same id" do
Fog::AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description')
raises(Fog::AWS::RDS::IdentifierTaken) {Fog::AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description')}
end
Fog::AWS[:rds].delete_db_parameter_group('fog-group')
end
end