Best Python code snippet using localstack_python
test_ec2_reserved_instances.py
Source:test_ec2_reserved_instances.py
1import cartography.intel.aws.ec2.reserved_instances2import tests.data.aws.ec2.reserved_instances3TEST_ACCOUNT_ID = '000000000000'4TEST_REGION = 'eu-west-1'5TEST_UPDATE_TAG = 1234567896def test_load_reserved_instances(neo4j_session):7 data = tests.data.aws.ec2.reserved_instances.DESCRIBE_RESERVED_INSTANCES8 cartography.intel.aws.ec2.reserved_instances.load_reserved_instances(9 neo4j_session,10 data,11 TEST_REGION,12 TEST_ACCOUNT_ID,13 TEST_UPDATE_TAG,14 )15 expected_nodes = {16 "res-01", "res-02",17 }18 nodes = neo4j_session.run(19 """20 MATCH (r:EC2ReservedInstance) RETURN r.id;21 """,22 )23 actual_nodes = {n['r.id'] for n in nodes}24 assert actual_nodes == expected_nodes25def test_load_reserved_instances_relationships(neo4j_session):26 # Create Test AWSAccount27 neo4j_session.run(28 """29 MERGE (aws:AWSAccount{id: {aws_account_id}})30 ON CREATE SET aws.firstseen = timestamp()31 SET aws.lastupdated = {aws_update_tag}32 """,33 aws_account_id=TEST_ACCOUNT_ID,34 aws_update_tag=TEST_UPDATE_TAG,35 )36 # Load Test Reserved Instances37 data = tests.data.aws.ec2.reserved_instances.DESCRIBE_RESERVED_INSTANCES38 cartography.intel.aws.ec2.reserved_instances.load_reserved_instances(39 neo4j_session,40 data,41 TEST_REGION,42 TEST_ACCOUNT_ID,43 TEST_UPDATE_TAG,44 )45 expected = {46 (TEST_ACCOUNT_ID, 'res-01'),47 (TEST_ACCOUNT_ID, 'res-02'),48 }49 # Fetch relationships50 result = neo4j_session.run(51 """52 MATCH (n1:AWSAccount)-[:RESOURCE]->(n2:EC2ReservedInstance) RETURN n1.id, n2.id;53 """,54 )55 actual = {56 (r['n1.id'], r['n2.id']) for r in result57 }...
reserved_instances.py
Source:reserved_instances.py
...9 if self.is_not_dryrun("CreateReservedInstances"):10 raise NotImplementedError(11 "ReservedInstances.create_reserved_instances_listing is not yet implemented"12 )13 def describe_reserved_instances(self):14 raise NotImplementedError(15 "ReservedInstances.describe_reserved_instances is not yet implemented"16 )17 def describe_reserved_instances_listings(self):18 raise NotImplementedError(19 "ReservedInstances.describe_reserved_instances_listings is not yet implemented"20 )21 def describe_reserved_instances_offerings(self):22 raise NotImplementedError(23 "ReservedInstances.describe_reserved_instances_offerings is not yet implemented"24 )25 def purchase_reserved_instances_offering(self):26 if self.is_not_dryrun("PurchaseReservedInstances"):27 raise NotImplementedError(...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!