跳转到主要内容

Neo4j服务器存根设置

项目描述

此软件包提供了一个基于真实neo4j服务器的neo4j服务器存根设置。

README

setup

此测试使用一个neo4j服务器。此测试的setUp方法调用了我们的startNeo4jServer方法,该方法启动了一个neo4j服务器。第一次调用此测试时,将下载一个新的neo4j服务器。测试设置如下

def test_suite():
    return unittest.TestSuite((
        doctest.DocFileSuite('README.txt',
            setUp=testing.doctestSetUp, tearDown=testing.doctestTearDown,
            optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
            encoding='utf-8'),
        ))

您的带有自定义conf文件夹的设置可能如下所示

def mySetUp(test):
    # setup neo4j server
    here = os.path.dirname(__file__)
    sandbox = os.path.join(here, 'sandbox')
    confSource = os.path.join(here, 'conf')
    startNeo4jServer(sandbox, confSource=confSource)


def myTearDown(test):
    # tear down neo4j server
    here = os.path.dirname(__file__)
    sandbox = os.path.join(here, 'sandbox')
    stopNeo4jServer(sandbox)
    # do some custom teardown stuff here

有关示例设置,请参阅我们的test.py。

windows

在Windows中,将在测试运行期间安装和删除名为p01_neo4jstub_testing的服务。这并不好,但这是neo4j在启动后停止的方式。如果发生故障且服务未删除,您可以简单地使用以下命令来删除服务

sc delete p01_neo4jstub_testing

测试

让我们设置一个python httplib连接

>>> import httplib
>>> conn = httplib.HTTPConnection('localhost', 47474)

并测试集群状态

>>> conn.request('GET', '/db/data')
>>> response = conn.getresponse()
>>> response.status
302

CHANGES

0.5.0 (28-06-2013)

  • 首次发布

项目细节


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

p01.neo4jstub-0.5.0.zip (22.2 kB 查看哈希值)

上传时间

支持者