fix(rds2): handle create_db_instance when AllocatedStorage is not specified

In all of the tests of `create_db_instance()`, the `AllocatedStorage`
parameter is provided.  The [RDS API
reference](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html)
says this parameter is optional; however, when none is provided, moto
returns an obscure error message:

```
self = <botocore.parsers.QueryParser object at 0x113745890>, shape = <Shape(Integer)>, text = 'None'

    @_text_content
    def _handle_integer(self, shape, text):
>       return int(text)
E       ValueError: invalid literal for int() with base 10: 'None'

/usr/local/Cellar/pyenv/1.2.13_1/versions/3.7.4/envs/rds_encrypt/lib/python3.7/site-packages/botocore/parsers.py:466: ValueError
```

This PR adds default values that correspond to the current default API
behaviors.
This commit is contained in:
Stephen Huff 2019-10-15 16:18:37 -04:00
commit 7b1cf9eecd
3 changed files with 92 additions and 1 deletions

View file

@ -39,6 +39,20 @@ def test_create_database():
db_instance['VpcSecurityGroups'][0]['VpcSecurityGroupId'].should.equal('sg-123456')
@mock_rds2
def test_create_database_no_allocated_storage():
conn = boto3.client('rds', region_name='us-west-2')
database = conn.create_db_instance(
DBInstanceIdentifier='db-master-1',
Engine='postgres',
DBName='staging-postgres',
DBInstanceClass='db.m1.small')
db_instance = database['DBInstance']
db_instance['Engine'].should.equal('postgres')
db_instance['StorageType'].should.equal('gp2')
db_instance['AllocatedStorage'].should.equal(20)
@mock_rds2
def test_create_database_non_existing_option_group():
conn = boto3.client('rds', region_name='us-west-2')