Don't pass the vpc id to boto.vpc.create_internet_gateway func (#37556)

That function's namespace looks like this:
```
def create_internet_gateway(self, dry_run=False):
```
So when we pass in the vpc_id opbject in the test, the check later
in the function sets `dry_run=True` since the vpc_id opbject exists.

This later throws JSONResponseErrors because the `DryRun` flag is
set. This error raising functionality was added in the most recent
version of moto, which exposed this bug.

This fixes the three boto_vpc_test unit state tests. We'll see if
other tests need to be addressed in other files on a full test run.
This commit is contained in:
Nicole Thomas 2016-11-08 12:48:26 -07:00 committed by GitHub
parent 89b9417605
commit 453319b50a
2 changed files with 7 additions and 6 deletions

View File

@ -184,7 +184,7 @@ class BotoVpcTestCaseMixin(object):
if not self.conn:
self.conn = boto.vpc.connect_to_region(region)
igw = self.conn.create_internet_gateway(vpc_id)
igw = self.conn.create_internet_gateway()
_maybe_set_name_tag(name, igw)
_maybe_set_tags(tags, igw)
return igw

View File

@ -307,11 +307,12 @@ class BotoVpcRouteTableTestCase(BotoVpcStateTestCaseBase, BotoVpcResourceTestCas
vpc = self._create_vpc(name='test')
igw = self._create_internet_gateway(name='test', vpc_id=vpc.id)
route_table_present_result = salt_states['boto_vpc.route_table_present'](
name='test', vpc_name='test', routes=[{'destination_cidr_block': '0.0.0.0/0',
'gateway_id': igw.id},
{'destination_cidr_block': '10.0.0.0/24',
'gateway_id': 'local'}])
with patch.dict('salt.utils.boto.__salt__', funcs):
route_table_present_result = salt_states['boto_vpc.route_table_present'](
name='test', vpc_name='test', routes=[{'destination_cidr_block': '0.0.0.0/0',
'gateway_id': igw.id},
{'destination_cidr_block': '10.0.0.0/24',
'gateway_id': 'local'}])
routes = [x['gateway_id'] for x in route_table_present_result['changes']['new']['routes']]
self.assertEqual(set(routes), set(['local', igw.id]))