Exemplo n.º 1
0
def test_load_client_module_class_missing(import_module):
    import_module.return_value = stub(foo='bar')

    try:
        utils.load_client('foo.bar.baz')
    except ImproperlyConfigured as e:
        assert 'Neo4j client module' in e.message
        raise e
Exemplo n.º 2
0
def test_load_client_fail_module_import(import_module):
    import_module.side_effect = ImportError

    try:
        utils.load_client('foo.bar.baz')
    except ImproperlyConfigured as e:
        assert 'Could not import' in e.message
        raise e
Exemplo n.º 3
0
def test_load_client_module_class_missing(import_module):
    import_module.return_value = stub(foo='bar')

    try:
        utils.load_client('foo.bar.baz')
    except ImproperlyConfigured as e:
        assert 'Neo4j client module' in e.message
        raise e
Exemplo n.º 4
0
def test_load_client_fail_module_import(import_module):
    import_module.side_effect = ImportError

    try:
        utils.load_client('foo.bar.baz')
    except ImproperlyConfigured as e:
        assert 'Could not import' in e.message
        raise e
Exemplo n.º 5
0
def test_load_client_not_correct_subclass(import_module):
    MyClass = type('MyClass', (object, ), {})
    import_module.return_value = stub(baz=MyClass)

    try:
        utils.load_client('foo.bar.baz')
    except ImproperlyConfigured as e:
        assert 'is not a subclass of EnhancedGraphDatabase' in e.message
        raise e
Exemplo n.º 6
0
def test_load_client_not_correct_subclass(import_module):
    MyClass = type('MyClass', (object,), {})
    import_module.return_value = stub(baz=MyClass)

    try:
        utils.load_client('foo.bar.baz')
    except ImproperlyConfigured as e:
        assert 'is not a subclass of EnhancedGraphDatabase' in e.message
        raise e
Exemplo n.º 7
0
def test_load_client(import_module):
    MyClass = type('MyClass', (EnhancedGraphDatabase, ), {})
    import_module.return_value = stub(baz=MyClass)

    assert utils.load_client('foo.bar.baz') == MyClass
Exemplo n.º 8
0
def test_load_client(import_module):
    MyClass = type('MyClass', (EnhancedGraphDatabase,), {})
    import_module.return_value = stub(baz=MyClass)

    assert utils.load_client('foo.bar.baz') == MyClass