Add StorageType and Iops elements to DBInstance XML response

This commit is contained in:
Hugo Lopes Tavares 2015-02-02 17:19:01 -05:00
parent 170d09b64c
commit c40437398f
3 changed files with 33 additions and 1 deletions

View File

@ -199,6 +199,12 @@ class Database(object):
<PubliclyAccessible>{{ database.publicly_accessible }}</PubliclyAccessible>
<AutoMinorVersionUpgrade>{{ database.auto_minor_version_upgrade }}</AutoMinorVersionUpgrade>
<AllocatedStorage>{{ database.allocated_storage }}</AllocatedStorage>
{% if database.iops %}
<Iops>{{ database.iops }}</Iops>
<StorageType>io1</StorageType>
{% else %}
<StorageType>{{ database.storage_type }}</StorageType>
{% endif %}
<DBInstanceClass>{{ database.db_instance_class }}</DBInstanceClass>
<MasterUsername>{{ database.master_username }}</MasterUsername>
<Endpoint>

View File

@ -26,6 +26,19 @@ class requires_boto_gte(object):
return skip_test
class requires_boto_lte(object):
"""Decorator for requiring boto version lesser than or equal to 'version'"""
def __init__(self, version):
self.version = version
def __call__(self, test):
boto_version = version_tuple(boto.__version__)
required = version_tuple(self.version)
if boto_version <= required:
return test
return skip_test
class disable_on_py3(object):
def __call__(self, test):
if not six.PY3:

View File

@ -6,7 +6,7 @@ from boto.exception import BotoServerError
import sure # noqa
from moto import mock_ec2, mock_rds
from tests.helpers import disable_on_py3
from tests.helpers import disable_on_py3, requires_boto_lte
@disable_on_py3()
@ -257,3 +257,16 @@ def test_connecting_to_us_east_1():
database.master_username.should.equal("root")
database.endpoint.should.equal(('db-master-1.aaaaaaaaaa.us-east-1.rds.amazonaws.com', 3306))
database.security_groups[0].name.should.equal('my_sg')
@requires_boto_lte('2.36.0')
@disable_on_py3()
@mock_rds
def test_create_database_with_iops():
conn = boto.rds.connect_to_region("us-west-2")
database = conn.create_dbinstance("db-master-1", 10, 'db.m1.small', 'root', 'hunter2', iops=6000)
database.status.should.equal('available')
database.iops.should.equal(6000)
database.StorageType.should.equal('io1')