@mock_ec2
def test_eip_allocate_vpc():
 conn = boto.connect_ec2(u'the_key', u'the_secret')
 with assert_raises(JSONResponseError) as ex:
  vpc = conn.allocate_address(domain=u'vpc', 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 AllocateAddress operation: Request would have succeeded, but DryRun flag is set')
 vpc = conn.allocate_address(domain=u'vpc')
 vpc.should.be.a(boto.ec2.address.Address)
 vpc.domain.should.be.equal(u'vpc')
 logging.debug(u'vpc alloc_id:'.format(vpc.allocation_id))
 vpc.release()

@ mock_ec2 def test_eip_allocate_vpc ( ) : conn = boto . connect_ec2 ( u'the_key' , u'the_secret' ) with assert_raises ( JSONResponseError ) as ex : vpc = conn . allocate_address ( domain = u'vpc' , 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 AllocateAddress operation: Request would have succeeded, but DryRun flag is set' ) vpc = conn . allocate_address ( domain = u'vpc' ) vpc . should . be . a ( boto . ec2 . address . Address ) vpc . domain . should . be . equal ( u'vpc' ) logging . debug ( u'vpc alloc_id:' . format ( vpc . allocation_id ) ) vpc . release ( )
allocate/release vpc eip .