Пример #1
0
 def test_basic_parameters_existence(self):
     hostname = "http://domain:7474"
     connector = neo4j.Connector(hostname)
     assert connector.endpoint.startswith(hostname)
     assert connector.endpoint.endswith(connector.default_path)
     assert connector.credentials != None
     assert connector.verbose_errors != None
Пример #2
0
 def test_basic_parameters_existence(self):
     hostname = 'http://domain:7474'
     connector = neo4j.Connector(hostname)
     self.assertTrue(connector.endpoint.startswith(hostname))
     self.assertTrue(connector.endpoint.endswith(connector.default_path))
     self.assertIsNotNone(connector.credentials)
     self.assertIsNotNone(connector.verbose_errors)
Пример #3
0
    def test_post(self, mock_get):
        hostname = 'hostname'
        credentials = ('username', 'password')

        connector = neo4j.Connector(hostname, credentials)
        connector.post([neo4j.Statement(self.cypher1)])

        expected_endpoint = hostname + connector.default_path

        mock_get.assert_called_once_with(expected_endpoint, auth=credentials,
                                         json={'statements': [{'statement': self.cypher1}]})
Пример #4
0
 def setUp(self):
     self.connector = neo4j.Connector()
Пример #5
0
#!/usr/bin/env python3
import neo4j
import os
import pathlib

cypher_file_name = "cypher-out.cypher"
cypher_path = "/mnt/inout/output/hef-graph-cypher/"
neo4jdb = neo4j.Connector("http://localhost:7474", ("neo4j", "12345"))

if pathlib.Path(cypher_path + cypher_file_name).is_file():
    cypherfile = cypher_path + cypher_file_name
else:
    print("no cypher output found. Using demo file.")
    cypherfile = cypher_file_name

with open(cypherfile, "r") as fh:
    lines = fh.readlines()
for i, cypher_query in enumerate(lines):
    print(i, cypher_query)
    neo4jdb.run(cypher_query)

print(
    "Creating Cypher finished. You can now visit localhost:7474/browser/ in your webbrowser and look at the neo4j database."
)