Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _ensure_local_neo4j_has_test_vpc_data(neo4j_session):
cartography.intel.gcp.compute.load_gcp_vpcs(
neo4j_session,
tests.data.gcp.compute.TRANSFORMED_GCP_VPCS,
TEST_UPDATE_TAG,
)
def test_transform_and_load_vpcs(neo4j_session):
"""
Test that we can correctly transform and load VPC nodes to Neo4j.
"""
vpc_res = tests.data.gcp.compute.VPC_RESPONSE
vpc_list = cartography.intel.gcp.compute.transform_gcp_vpcs(vpc_res)
cartography.intel.gcp.compute.load_gcp_vpcs(neo4j_session, vpc_list, TEST_UPDATE_TAG)
query = """
MATCH(vpc:GCPVpc{id:{VpcId}})
RETURN vpc.id, vpc.partial_uri, vpc.auto_create_subnetworks
"""
expected_vpc_id = 'projects/project-abc/global/networks/default'
nodes = neo4j_session.run(
query,
VpcId=expected_vpc_id,
)
actual_nodes = {(n['vpc.id'], n['vpc.partial_uri'], n['vpc.auto_create_subnetworks']) for n in nodes}
expected_nodes = {
(expected_vpc_id, expected_vpc_id, True),
}
assert actual_nodes == expected_nodes