How to use create_vpn_connection method in localstack

Best Python code snippet using localstack_python

test_vpn_connections.py

Source:test_vpn_connections.py Github

copy

Full Screen

...7from moto import mock_ec2, mock_ec2_deprecated8@mock_ec2_deprecated9def test_create_vpn_connections():10 conn = boto.connect_vpc("the_key", "the_secret")11 vpn_connection = conn.create_vpn_connection(12 "ipsec.1", "vgw-0123abcd", "cgw-0123abcd"13 )14 vpn_connection.should_not.be.none15 vpn_connection.id.should.match(r"vpn-\w+")16 vpn_connection.type.should.equal("ipsec.1")17@mock_ec2_deprecated18def test_delete_vpn_connections():19 conn = boto.connect_vpc("the_key", "the_secret")20 vpn_connection = conn.create_vpn_connection(21 "ipsec.1", "vgw-0123abcd", "cgw-0123abcd"22 )23 list_of_vpn_connections = conn.get_all_vpn_connections()24 list_of_vpn_connections.should.have.length_of(1)25 conn.delete_vpn_connection(vpn_connection.id)26 list_of_vpn_connections = conn.get_all_vpn_connections()27 list_of_vpn_connections.should.have.length_of(0)28@mock_ec2_deprecated29def test_delete_vpn_connections_bad_id():30 conn = boto.connect_vpc("the_key", "the_secret")31 with pytest.raises(EC2ResponseError):32 conn.delete_vpn_connection("vpn-0123abcd")33@mock_ec2_deprecated34def test_describe_vpn_connections():35 conn = boto.connect_vpc("the_key", "the_secret")36 list_of_vpn_connections = conn.get_all_vpn_connections()37 list_of_vpn_connections.should.have.length_of(0)38 conn.create_vpn_connection("ipsec.1", "vgw-0123abcd", "cgw-0123abcd")39 list_of_vpn_connections = conn.get_all_vpn_connections()40 list_of_vpn_connections.should.have.length_of(1)41 vpn = conn.create_vpn_connection("ipsec.1", "vgw-1234abcd", "cgw-1234abcd")42 list_of_vpn_connections = conn.get_all_vpn_connections()43 list_of_vpn_connections.should.have.length_of(2)44 list_of_vpn_connections = conn.get_all_vpn_connections(vpn.id)45 list_of_vpn_connections.should.have.length_of(1)46@mock_ec247def test_create_vpn_connection_with_vpn_gateway():48 client = boto3.client("ec2", region_name="us-east-1")49 vpn_gateway = client.create_vpn_gateway(Type="ipsec.1").get("VpnGateway", {})50 customer_gateway = client.create_customer_gateway(51 Type="ipsec.1", PublicIp="205.251.242.54", BgpAsn=65534,52 ).get("CustomerGateway", {})53 vpn_connection = client.create_vpn_connection(54 Type="ipsec.1",55 VpnGatewayId=vpn_gateway["VpnGatewayId"],56 CustomerGatewayId=customer_gateway["CustomerGatewayId"],57 ).get("VpnConnection", {})58 vpn_connection["Type"].should.equal("ipsec.1")59 vpn_connection["VpnGatewayId"].should.equal(vpn_gateway["VpnGatewayId"])60 vpn_connection["CustomerGatewayId"].should.equal(61 customer_gateway["CustomerGatewayId"]...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful