Skip to content

Commit

Permalink
Adjusted to default TOFU security level
Browse files Browse the repository at this point in the history
  • Loading branch information
technige committed Feb 25, 2016
1 parent 844dce5 commit e9269db
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
5 changes: 3 additions & 2 deletions examples/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
# limitations under the License.


from unittest import TestCase
from test.util import ServerTestCase

# tag::minimal-example-import[]
from neo4j.v1 import GraphDatabase
# end::minimal-example-import[]


class FreshDatabaseTestCase(TestCase):
class FreshDatabaseTestCase(ServerTestCase):

def setUp(self):
ServerTestCase.setUp(self)
session = GraphDatabase.driver("bolt://localhost").session()
session.run("MATCH (n) DETACH DELETE n")
session.close()
Expand Down
3 changes: 1 addition & 2 deletions neo4j/v1/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,8 @@ def match_or_trust(self, host, der_encoded_certificate):
with open(self.path) as f_in:
for line in f_in:
known_host, _, known_cert = line.strip().partition(":")
known_cert = known_cert.encode("utf-8")
if host == known_host:
print("Received: %s" % base64_encoded_certificate)
print("Known: %s" % known_cert)
return base64_encoded_certificate == known_cert
# First use (no hosts match)
try:
Expand Down
17 changes: 8 additions & 9 deletions test/tck/tck_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from neo4j.v1 import compat, Relationship, Node, Path
from neo4j.v1 import GraphDatabase, Relationship, Node, Path, SECURITY_NONE
from neo4j.v1.compat import string

from neo4j.v1 import GraphDatabase

driver = GraphDatabase.driver("bolt://localhost")
driver = GraphDatabase.driver("bolt://localhost", security=SECURITY_NONE)


def send_string(text):
Expand All @@ -39,11 +39,10 @@ def send_parameters(statement, parameters):
return list(cursor.stream())


def to_unicode(val):
try:
return unicode(val)
except NameError:
return str(val)
try:
to_unicode = unicode
except NameError:
to_unicode = str


def string_to_type(str):
Expand Down Expand Up @@ -91,7 +90,7 @@ def __init__(self, entity):
elif isinstance(entity, Path):
self.content = self.create_path(entity)
elif isinstance(entity, int) or isinstance(entity, float) or isinstance(entity,
(str, compat.string)) or entity is None:
(str, string)) or entity is None:
self.content['value'] = entity
else:
raise ValueError("Do not support object type: %s" % entity)
Expand Down
2 changes: 1 addition & 1 deletion test/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def test_keys_with_an_error(self):
_ = list(cursor.keys())


class SummaryTestCase(TestCase):
class SummaryTestCase(ServerTestCase):

def test_can_obtain_summary_after_consuming_result(self):
with GraphDatabase.driver("bolt://localhost").session() as session:
Expand Down

0 comments on commit e9269db

Please sign in to comment.