Skip to content

Commit

Permalink
Integration test modifications (aws#270)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Chin <[email protected]>
  • Loading branch information
michaelnchin and michaelnchin authored Mar 1, 2022
1 parent 5c2d311 commit 410722d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 100 deletions.
2 changes: 1 addition & 1 deletion test/integration/DataDrivenGremlinTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def setUp(self):
super().setUp()

self.client = self.client_builder.build()
query_check_for_airports = "g.V('3684').outE().inV().has(id, '3444')"
query_check_for_airports = "g.V('3745').outE().inV().has(id, '3195')"
res = self.client.gremlin_query(query_check_for_airports)
if len(res) < 1:
logging.info('did not find final airports edge, seeding database now...')
Expand Down
27 changes: 17 additions & 10 deletions test/integration/IntegrationTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,23 @@


def setup_client_builder(config: Configuration) -> ClientBuilder:
builder = ClientBuilder() \
.with_host(config.host) \
.with_port(config.port) \
.with_region(config.aws_region) \
.with_tls(config.ssl) \
.with_sparql_path(config.sparql.path) \
.with_gremlin_traversal_source(config.gremlin.traversal_source)

if config.auth_mode == AuthModeEnum.IAM:
builder = builder.with_iam(get_session())
if "amazonaws.com" in config.host:
builder = ClientBuilder() \
.with_host(config.host) \
.with_port(config.port) \
.with_region(config.aws_region) \
.with_tls(config.ssl) \
.with_sparql_path(config.sparql.path) \
.with_gremlin_traversal_source(config.gremlin.traversal_source)
if config.auth_mode == AuthModeEnum.IAM:
builder = builder.with_iam(get_session())
else:
builder = ClientBuilder() \
.with_host(config.host) \
.with_port(config.port) \
.with_tls(config.ssl) \
.with_sparql_path(config.sparql.path) \
.with_gremlin_traversal_source(config.gremlin.traversal_source)

return builder

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def setUp(self) -> None:
self.client = self.client_builder.with_iam(get_session()).build()

@pytest.mark.jupyter
@pytest.mark.gremlin
@pytest.mark.opencypher
def test_gremlin_query(self):
query = '''MATCH(a)-->(b)
RETURN b
Expand Down
79 changes: 0 additions & 79 deletions test/integration/without_iam/gremlin/test_gremlin_patching.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def test_add_paths_to_network(self):
gremlin_network = GremlinNetwork()
gremlin_network.add_results(results)
sea_code = '22'
aus_code = '3'
edge_id = '4406'
jnu_code = '1102'
edge_id = '7527'
expected_label = 'route'
actual_label = gremlin_network.graph[sea_code][aus_code][edge_id]['label']
actual_label = gremlin_network.graph[sea_code][jnu_code][edge_id]['label']
self.assertEqual(expected_label, actual_label)

@pytest.mark.gremlin
Expand All @@ -30,7 +30,7 @@ def test_add_value_map_to_network(self):
results = self.client.gremlin_query(airports_path_query)
gremlin_network = GremlinNetwork()
gremlin_network.add_results(results)
edge_id = '4406'
edge_id = '7473'
expected_label = 'route'
actual_label = gremlin_network.graph.nodes.get(edge_id)['label']
self.assertEqual(expected_label, actual_label)
Expand All @@ -47,8 +47,8 @@ def test_add_entire_path(self):
self.assertIsNotNone(gremlin_network.graph.nodes.get('22'))
self.assertIsNotNone(gremlin_network.graph.nodes.get('18'))
self.assertIsNotNone(gremlin_network.graph.nodes.get('359'))
self.assertTrue(gremlin_network.graph.has_edge('22', '18', '4420'))
self.assertTrue(gremlin_network.graph.has_edge('18', '359', '7126'))
self.assertTrue(gremlin_network.graph.has_edge('22', '18', '4480'))
self.assertTrue(gremlin_network.graph.has_edge('18', '359', '7208'))

@pytest.mark.gremlin
def test_add_paths_with_bad_pattern(self):
Expand All @@ -71,7 +71,7 @@ def test_add_path_with_repeat(self):

gremlin_network = GremlinNetwork()
gremlin_network.add_results(results)
self.assertEqual('route', gremlin_network.graph.edges[('ANC', 'BLI', '5276')]['label'])
self.assertEqual('route', gremlin_network.graph.edges[('ANC', 'BLI', '5339')]['label'])

@pytest.mark.gremlin
def test_valuemap_without_ids(self):
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_path_without_by_oute_has_arrows(self):
results = self.client.gremlin_query(query)
gremlin_network = GremlinNetwork()
gremlin_network.add_results(results)
edge = gremlin_network.graph.edges[('22', '151', '7389')]
edge = gremlin_network.graph.edges[('22', '151', '7474')]
self.assertTrue('arrows' not in edge)

@pytest.mark.gremlin
Expand All @@ -108,5 +108,5 @@ def test_path_without_by_ine_has_arrows(self):
results = self.client.gremlin_query(query)
gremlin_network = GremlinNetwork()
gremlin_network.add_results(results)
edge = gremlin_network.graph.edges[('3670', '22', '53637')]
edge = gremlin_network.graph.edges[('3728', '22', '54424')]
self.assertTrue('arrows' not in edge)

0 comments on commit 410722d

Please sign in to comment.