@mock_ec2
def test_dhcp_options_delete_with_vpc():
 conn = boto.connect_vpc(u'the_key', u'the_secret')
 dhcp_options = conn.create_dhcp_options(SAMPLE_DOMAIN_NAME, SAMPLE_NAME_SERVERS)
 dhcp_options_id = dhcp_options.id
 vpc = conn.create_vpc(u'10.0.0.0/16')
 rval = conn.associate_dhcp_options(dhcp_options_id, vpc.id)
 rval.should.be.equal(True)
 with assert_raises(EC2ResponseError) as cm:
  conn.delete_dhcp_options(dhcp_options_id)
 cm.exception.code.should.equal(u'DependencyViolation')
 cm.exception.status.should.equal(400)
 cm.exception.request_id.should_not.be.none
 vpc.delete()
 with assert_raises(EC2ResponseError) as cm:
  conn.get_all_dhcp_options([dhcp_options_id])
 cm.exception.code.should.equal(u'InvalidDhcpOptionID.NotFound')
 cm.exception.status.should.equal(400)
 cm.exception.request_id.should_not.be.none

@ mock_ec2 def test_dhcp_options_delete_with_vpc ( ) : conn = boto . connect_vpc ( u'the_key' , u'the_secret' ) dhcp_options = conn . create_dhcp_options ( SAMPLE_DOMAIN_NAME , SAMPLE_NAME_SERVERS ) dhcp_options_id = dhcp_options . id vpc = conn . create_vpc ( u'10.0.0.0/16' ) rval = conn . associate_dhcp_options ( dhcp_options_id , vpc . id ) rval . should . be . equal ( True ) with assert_raises ( EC2ResponseError ) as cm : conn . delete_dhcp_options ( dhcp_options_id ) cm . exception . code . should . equal ( u'DependencyViolation' ) cm . exception . status . should . equal ( 400 ) cm . exception . request_id . should_not . be . none vpc . delete ( ) with assert_raises ( EC2ResponseError ) as cm : conn . get_all_dhcp_options ( [ dhcp_options_id ] ) cm . exception . code . should . equal ( u'InvalidDhcpOptionID.NotFound' ) cm . exception . status . should . equal ( 400 ) cm . exception . request_id . should_not . be . none
test deletion of dhcp options with vpc .