From 9e305ae0c8ca511ed0042c83fd6c98a2a5d52ae8 Mon Sep 17 00:00:00 2001 From: Petra Selmer Date: Fri, 25 Nov 2016 09:54:37 +0000 Subject: [PATCH 1/2] Changed `localhost` to `myserver:7687` in examples --- examples/test_examples.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/test_examples.py b/examples/test_examples.py index ba68fac0c..8644944eb 100644 --- a/examples/test_examples.py +++ b/examples/test_examples.py @@ -39,7 +39,7 @@ class FreshDatabaseTestCase(ServerTestCase): def setUp(self): ServerTestCase.setUp(self) - session = GraphDatabase.driver("bolt://localhost", auth=auth_token).session() + session = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token).session() session.run("MATCH (n) DETACH DELETE n") session.close() @@ -48,7 +48,7 @@ class MinimalWorkingExampleTestCase(FreshDatabaseTestCase): def test_minimal_working_example(self): # tag::minimal-example[] - driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j")) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j")) session = driver.session() session.run("CREATE (a:Person {name:'Arthur', title:'King'})") @@ -65,45 +65,45 @@ class ExamplesTestCase(FreshDatabaseTestCase): def test_construct_driver(self): # tag::construct-driver[] - driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j")) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j")) # end::construct-driver[] return driver def test_configuration(self): # tag::configuration[] - driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"), max_pool_size=10) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j"), max_pool_size=10) # end::configuration[] return driver @skipUnless(SSL_AVAILABLE, "Bolt over TLS is not supported by this version of Python") def test_tls_require_encryption(self): # tag::tls-require-encryption[] - driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"), encrypted=True) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j"), encrypted=True) # end::tls-require-encryption[] @skipUnless(SSL_AVAILABLE, "Bolt over TLS is not supported by this version of Python") def test_tls_trust_on_first_use(self): # tag::tls-trust-on-first-use[] - driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"), encrypted=True, trust=TRUST_ON_FIRST_USE) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j"), encrypted=True, trust=TRUST_ON_FIRST_USE) # end::tls-trust-on-first-use[] assert driver @skip("testing verified certificates not yet supported ") def test_tls_signed(self): # tag::tls-signed[] - driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"), encrypted=True, trust=TRUST_SIGNED_CERTIFICATES) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j"), encrypted=True, trust=TRUST_SIGNED_CERTIFICATES) # end::tls-signed[] assert driver @skipUnless(SSL_AVAILABLE, "Bolt over TLS is not supported by this version of Python") def test_connect_with_auth_disabled(self): # tag::connect-with-auth-disabled[] - driver = GraphDatabase.driver("bolt://localhost", encrypted=True) + driver = GraphDatabase.driver("bolt://myserver:7687", encrypted=True) # end::connect-with-auth-disabled[] assert driver def test_statement(self): - driver = GraphDatabase.driver("bolt://localhost", auth=auth_token) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) session = driver.session() # tag::statement[] result = session.run("CREATE (person:Person {name: {name}})", {"name": "Arthur"}) @@ -112,7 +112,7 @@ def test_statement(self): session.close() def test_statement_without_parameters(self): - driver = GraphDatabase.driver("bolt://localhost", auth=auth_token) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) session = driver.session() # tag::statement-without-parameters[] result = session.run("CREATE (person:Person {name: 'Arthur'})") @@ -121,7 +121,7 @@ def test_statement_without_parameters(self): session.close() def test_result_traversal(self): - driver = GraphDatabase.driver("bolt://localhost", auth=auth_token) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) session = driver.session() # tag::result-traversal[] search_term = "Sword" @@ -134,7 +134,7 @@ def test_result_traversal(self): session.close() def test_access_record(self): - driver = GraphDatabase.driver("bolt://localhost", auth=auth_token) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) session = driver.session() # tag::access-record[] search_term = "Arthur" @@ -147,7 +147,7 @@ def test_access_record(self): session.close() def test_result_retention(self): - driver = GraphDatabase.driver("bolt://localhost", auth=auth_token) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) # tag::retain-result[] session = driver.session() result = session.run("MATCH (knight:Person:Knight) WHERE knight.castle = {castle} " @@ -160,7 +160,7 @@ def test_result_retention(self): assert isinstance(retained_result, list) def test_nested_statements(self): - driver = GraphDatabase.driver("bolt://localhost", auth=auth_token) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) session = driver.session() # tag::nested-statements[] result = session.run("MATCH (knight:Person:Knight) WHERE knight.castle = {castle} " @@ -173,7 +173,7 @@ def test_nested_statements(self): session.close() def test_transaction_commit(self): - driver = GraphDatabase.driver("bolt://localhost", auth=auth_token) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) session = driver.session() # tag::transaction-commit[] with session.begin_transaction() as tx: @@ -186,7 +186,7 @@ def test_transaction_commit(self): session.close() def test_transaction_rollback(self): - driver = GraphDatabase.driver("bolt://localhost", auth=auth_token) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) session = driver.session() # tag::transaction-rollback[] with session.begin_transaction() as tx: @@ -199,7 +199,7 @@ def test_transaction_rollback(self): session.close() def test_result_summary_query_profile(self): - driver = GraphDatabase.driver("bolt://localhost", auth=auth_token) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) session = driver.session() # tag::result-summary-query-profile[] result = session.run("PROFILE MATCH (p:Person {name: {name}}) " @@ -211,7 +211,7 @@ def test_result_summary_query_profile(self): session.close() def test_result_summary_notifications(self): - driver = GraphDatabase.driver("bolt://localhost", auth=auth_token) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) session = driver.session() # tag::result-summary-notifications[] result = session.run("EXPLAIN MATCH (king), (queen) RETURN king, queen") @@ -222,7 +222,7 @@ def test_result_summary_notifications(self): session.close() def test_handle_cypher_error(self): - driver = GraphDatabase.driver("bolt://localhost", auth=auth_token) + driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) session = driver.session() with self.assertRaises(RuntimeError): # tag::handle-cypher-error[] From f48a735d50a2913f436cedfb3498280a8b734c64 Mon Sep 17 00:00:00 2001 From: Petra Selmer Date: Fri, 25 Nov 2016 11:28:50 +0000 Subject: [PATCH 2/2] Changed `myserver` -> `localhost` in examples --- examples/test_examples.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/test_examples.py b/examples/test_examples.py index 8644944eb..e6822c75f 100644 --- a/examples/test_examples.py +++ b/examples/test_examples.py @@ -39,7 +39,7 @@ class FreshDatabaseTestCase(ServerTestCase): def setUp(self): ServerTestCase.setUp(self) - session = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token).session() + session = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token).session() session.run("MATCH (n) DETACH DELETE n") session.close() @@ -48,7 +48,7 @@ class MinimalWorkingExampleTestCase(FreshDatabaseTestCase): def test_minimal_working_example(self): # tag::minimal-example[] - driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j")) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j", "neo4j")) session = driver.session() session.run("CREATE (a:Person {name:'Arthur', title:'King'})") @@ -65,45 +65,45 @@ class ExamplesTestCase(FreshDatabaseTestCase): def test_construct_driver(self): # tag::construct-driver[] - driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j")) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j", "neo4j")) # end::construct-driver[] return driver def test_configuration(self): # tag::configuration[] - driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j"), max_pool_size=10) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j", "neo4j"), max_pool_size=10) # end::configuration[] return driver @skipUnless(SSL_AVAILABLE, "Bolt over TLS is not supported by this version of Python") def test_tls_require_encryption(self): # tag::tls-require-encryption[] - driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j"), encrypted=True) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j", "neo4j"), encrypted=True) # end::tls-require-encryption[] @skipUnless(SSL_AVAILABLE, "Bolt over TLS is not supported by this version of Python") def test_tls_trust_on_first_use(self): # tag::tls-trust-on-first-use[] - driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j"), encrypted=True, trust=TRUST_ON_FIRST_USE) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j", "neo4j"), encrypted=True, trust=TRUST_ON_FIRST_USE) # end::tls-trust-on-first-use[] assert driver @skip("testing verified certificates not yet supported ") def test_tls_signed(self): # tag::tls-signed[] - driver = GraphDatabase.driver("bolt://myserver:7687", auth=basic_auth("neo4j", "neo4j"), encrypted=True, trust=TRUST_SIGNED_CERTIFICATES) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j", "neo4j"), encrypted=True, trust=TRUST_SIGNED_CERTIFICATES) # end::tls-signed[] assert driver @skipUnless(SSL_AVAILABLE, "Bolt over TLS is not supported by this version of Python") def test_connect_with_auth_disabled(self): # tag::connect-with-auth-disabled[] - driver = GraphDatabase.driver("bolt://myserver:7687", encrypted=True) + driver = GraphDatabase.driver("bolt://localhost:7687", encrypted=True) # end::connect-with-auth-disabled[] assert driver def test_statement(self): - driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token) session = driver.session() # tag::statement[] result = session.run("CREATE (person:Person {name: {name}})", {"name": "Arthur"}) @@ -112,7 +112,7 @@ def test_statement(self): session.close() def test_statement_without_parameters(self): - driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token) session = driver.session() # tag::statement-without-parameters[] result = session.run("CREATE (person:Person {name: 'Arthur'})") @@ -121,7 +121,7 @@ def test_statement_without_parameters(self): session.close() def test_result_traversal(self): - driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token) session = driver.session() # tag::result-traversal[] search_term = "Sword" @@ -134,7 +134,7 @@ def test_result_traversal(self): session.close() def test_access_record(self): - driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token) session = driver.session() # tag::access-record[] search_term = "Arthur" @@ -147,7 +147,7 @@ def test_access_record(self): session.close() def test_result_retention(self): - driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token) # tag::retain-result[] session = driver.session() result = session.run("MATCH (knight:Person:Knight) WHERE knight.castle = {castle} " @@ -160,7 +160,7 @@ def test_result_retention(self): assert isinstance(retained_result, list) def test_nested_statements(self): - driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token) session = driver.session() # tag::nested-statements[] result = session.run("MATCH (knight:Person:Knight) WHERE knight.castle = {castle} " @@ -173,7 +173,7 @@ def test_nested_statements(self): session.close() def test_transaction_commit(self): - driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token) session = driver.session() # tag::transaction-commit[] with session.begin_transaction() as tx: @@ -186,7 +186,7 @@ def test_transaction_commit(self): session.close() def test_transaction_rollback(self): - driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token) session = driver.session() # tag::transaction-rollback[] with session.begin_transaction() as tx: @@ -199,7 +199,7 @@ def test_transaction_rollback(self): session.close() def test_result_summary_query_profile(self): - driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token) session = driver.session() # tag::result-summary-query-profile[] result = session.run("PROFILE MATCH (p:Person {name: {name}}) " @@ -211,7 +211,7 @@ def test_result_summary_query_profile(self): session.close() def test_result_summary_notifications(self): - driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token) session = driver.session() # tag::result-summary-notifications[] result = session.run("EXPLAIN MATCH (king), (queen) RETURN king, queen") @@ -222,7 +222,7 @@ def test_result_summary_notifications(self): session.close() def test_handle_cypher_error(self): - driver = GraphDatabase.driver("bolt://myserver:7687", auth=auth_token) + driver = GraphDatabase.driver("bolt://localhost:7687", auth=auth_token) session = driver.session() with self.assertRaises(RuntimeError): # tag::handle-cypher-error[]