Beispiel #1
0
def test_authentication_adds_the_correct_header():
    from py2neo.core import _headers
    _headers.clear()
    _headers.update({None: [("X-Stream", "true")]})
    authenticate("localhost:7474", "arthur", "excalibur")
    headers = _get_headers("localhost:7474")
    assert headers['Authorization'] == 'Basic YXJ0aHVyOmV4Y2FsaWJ1cg=='
Beispiel #2
0
def test_authentication_adds_the_correct_header():
    from py2neo.core import _headers
    _headers.clear()
    _headers.update({None: [("X-Stream", "true")]})
    authenticate("localhost:7474", "arthur", "excalibur")
    headers = _get_headers("localhost:7474")
    assert headers['Authorization'] == 'Basic YXJ0aHVyOmV4Y2FsaWJ1cg=='
Beispiel #3
0
def test_implicit_authentication_through_resource_constructor():
    from py2neo.core import _headers, Resource
    _headers.clear()
    _headers.update({None: [("X-Stream", "true")]})
    resource = Resource("http://*****:*****@localhost:7474/")
    headers = _get_headers("localhost:7474")
    assert headers['Authorization'] == 'Basic YXJ0aHVyOmV4Y2FsaWJ1cg=='
    assert resource.headers['Authorization'] == 'Basic YXJ0aHVyOmV4Y2FsaWJ1cg=='
Beispiel #4
0
def test_implicit_authentication_through_resource_constructor():
    from py2neo.core import _headers, Resource
    _headers.clear()
    _headers.update({None: [("X-Stream", "true")]})
    resource = Resource("http://*****:*****@localhost:7474/")
    headers = _get_headers("localhost:7474")
    assert headers['Authorization'] == 'Basic YXJ0aHVyOmV4Y2FsaWJ1cg=='
    assert resource.headers['Authorization'] == 'Basic YXJ0aHVyOmV4Y2FsaWJ1cg=='