Skip to content

Commit 3548fed

Browse files
author
Zhen
committed
Changed password from password to neo4j
Enabled runtests script to accept neorun.start args so that we could change version for running tests against 3.1 server Fixed the bug in runtests script where it cannot accept `test=name` to run a single unit test
1 parent 66a8f0f commit 3548fed

File tree

6 files changed

+27
-18
lines changed

6 files changed

+27
-18
lines changed

examples/test_examples.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# (* "good reason" is defined as knowing what you are doing)
3333

3434

35-
auth_token = basic_auth("neo4j", "password")
35+
auth_token = basic_auth("neo4j", "neo4j")
3636

3737

3838
class FreshDatabaseTestCase(ServerTestCase):
@@ -48,7 +48,7 @@ class MinimalWorkingExampleTestCase(FreshDatabaseTestCase):
4848

4949
def test_minimal_working_example(self):
5050
# tag::minimal-example[]
51-
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "password"))
51+
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"))
5252
session = driver.session()
5353

5454
session.run("CREATE (a:Person {name:'Arthur', title:'King'})")
@@ -65,33 +65,33 @@ class ExamplesTestCase(FreshDatabaseTestCase):
6565

6666
def test_construct_driver(self):
6767
# tag::construct-driver[]
68-
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "password"))
68+
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"))
6969
# end::construct-driver[]
7070
return driver
7171

7272
def test_configuration(self):
7373
# tag::configuration[]
74-
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "password"), max_pool_size=10)
74+
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"), max_pool_size=10)
7575
# end::configuration[]
7676
return driver
7777

7878
@skipUnless(SSL_AVAILABLE, "Bolt over TLS is not supported by this version of Python")
7979
def test_tls_require_encryption(self):
8080
# tag::tls-require-encryption[]
81-
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "password"), encrypted=True)
81+
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"), encrypted=True)
8282
# end::tls-require-encryption[]
8383

8484
@skipUnless(SSL_AVAILABLE, "Bolt over TLS is not supported by this version of Python")
8585
def test_tls_trust_on_first_use(self):
8686
# tag::tls-trust-on-first-use[]
87-
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "password"), encrypted=True, trust=TRUST_ON_FIRST_USE)
87+
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"), encrypted=True, trust=TRUST_ON_FIRST_USE)
8888
# end::tls-trust-on-first-use[]
8989
assert driver
9090

9191
@skip("testing verified certificates not yet supported ")
9292
def test_tls_signed(self):
9393
# tag::tls-signed[]
94-
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "password"), encrypted=True, trust=TRUST_SIGNED_CERTIFICATES)
94+
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"), encrypted=True, trust=TRUST_SIGNED_CERTIFICATES)
9595
# end::tls-signed[]
9696
assert driver
9797

neokit

runtests.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@
2020

2121
"""
2222
Usage: runtests.py
23+
-h : show this help message
2324
--test=name : run this specific test
24-
--test : run all unit tests
25+
--tests : run all unit tests
2526
--examples : run all example tests
2627
--tck : run tck tests
27-
-h : show this help message
28+
--neorun.start.args : args to neorun script
2829
example:
29-
python ./runtests.py --test --examples --tck
30+
python ./runtests.py --tests --examples --tck
31+
python ./runtests.py --tests --examples --tck --neorun.start.args="-n 3.1 -p neo4j"
3032
"""
3133
from sys import argv, stdout, exit
3234
from os import name, path
@@ -38,7 +40,7 @@
3840
BEHAVE_RUNNER="behave --tags=-db --tags=-tls --tags=-fixed_session_pool test/tck"
3941

4042
NEORUN_PATH = path.abspath('./neokit/neorun.py')
41-
NEO4J_HOME = path.abspath('./resources/neo4jhome')
43+
NEO4J_HOME = path.abspath('./build/neo4jhome')
4244

4345
is_windows = (name == 'nt')
4446

@@ -73,7 +75,7 @@ def main():
7375
print_help()
7476
exit(2)
7577
try:
76-
opts, args = getopt.getopt(argv[1:], "h", ["test=", "test", "examples", "tck"])
78+
opts, args = getopt.getopt(argv[1:], "h", ["test=", "tests", "examples", "tck", "neorun.start.args="])
7779
except getopt.GetoptError as err:
7880
print(str(err))
7981
print_help()
@@ -86,13 +88,20 @@ def main():
8688
retcode = 0
8789

8890
register(neorun, '--stop=' + NEO4J_HOME)
89-
neorun('--start=' + NEO4J_HOME + ' -v 3.0.1 -p password')
91+
92+
neorun_args = '-p neo4j'
93+
for opt, arg in opts:
94+
if opt == '--neorun.start.args':
95+
neorun_args = arg
96+
break
97+
neorun('--start=' + NEO4J_HOME + ' ' + neorun_args)
98+
9099
for opt, arg in opts:
91100
if opt == '-h':
92101
print_help()
93102
retcode = 2
94103

95-
elif opt == "--test":
104+
elif opt == "--tests":
96105
retcode = retcode or runcommand(UNITTEST_RUNNER + "test")
97106
elif opt == "--test=":
98107
retcode = retcode or runcommand(UNITTEST_RUNNER + arg)

test/tck/steps/driver_auth_steps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def step_impl(context):
3030

3131
@given("a driver is configured with auth enabled and correct password is provided")
3232
def step_impl(context):
33-
context.driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "password"), encrypted=False)
33+
context.driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"), encrypted=False)
3434

3535

3636
@given("a driver is configured with auth enabled and the wrong password is provided")

test/tck/tck_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from test.tck.test_value import TestValue
2424
from test.tck.resultparser import parse_values_to_comparable
2525

26-
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "password"), encrypted=False)
26+
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j"), encrypted=False)
2727
runners = []
2828

2929

test/test_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from test.util import ServerTestCase
3434

3535

36-
auth_token = basic_auth("neo4j", "password")
36+
auth_token = basic_auth("neo4j", "neo4j")
3737
from neo4j.v1.exceptions import ProtocolError
3838

3939

0 commit comments

Comments
 (0)