@mock_ec2
def test_igw_attach():
 conn = boto.connect_vpc(u'the_key', u'the_secret')
 igw = conn.create_internet_gateway()
 vpc = conn.create_vpc(VPC_CIDR)
 with assert_raises(JSONResponseError) as ex:
  conn.attach_internet_gateway(igw.id, vpc.id, dry_run=True)
 ex.exception.reason.should.equal(u'DryRunOperation')
 ex.exception.status.should.equal(400)
 ex.exception.message.should.equal(u'An error occurred (DryRunOperation) when calling the AttachInternetGateway operation: Request would have succeeded, but DryRun flag is set')
 conn.attach_internet_gateway(igw.id, vpc.id)
 igw = conn.get_all_internet_gateways()[0]
 igw.attachments[0].vpc_id.should.be.equal(vpc.id)

@ mock_ec2 def test_igw_attach ( ) : conn = boto . connect_vpc ( u'the_key' , u'the_secret' ) igw = conn . create_internet_gateway ( ) vpc = conn . create_vpc ( VPC_CIDR ) with assert_raises ( JSONResponseError ) as ex : conn . attach_internet_gateway ( igw . id , vpc . id , dry_run = True ) ex . exception . reason . should . equal ( u'DryRunOperation' ) ex . exception . status . should . equal ( 400 ) ex . exception . message . should . equal ( u'An error occurred (DryRunOperation) when calling the AttachInternetGateway operation: Request would have succeeded, but DryRun flag is set' ) conn . attach_internet_gateway ( igw . id , vpc . id ) igw = conn . get_all_internet_gateways ( ) [ 0 ] igw . attachments [ 0 ] . vpc_id . should . be . equal ( vpc . id )
internet gateway attach .