def test_bolt_handshake_error(): handshake = b"\x00\x00\x00\x04\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00" response = b"\x00\x00\x00\x00" supported_versions = Bolt.protocol_handlers().keys() with pytest.raises(BoltHandshakeError) as e: error = BoltHandshakeError( "The Neo4J server does not support communication with this driver. Supported Bolt Protocols {}" .format(supported_versions), address="localhost", request_data=handshake, response_data=response) assert error.address == "localhost" assert error.request_data == handshake assert error.response_data == response raise error e.match( "The Neo4J server does not support communication with this driver. Supported Bolt Protocols " )
def test_class_method_protocol_handlers_with_protocol_version( test_input, expected): # python -m pytest tests/unit/io/test_class_bolt.py -s -v -k test_class_method_protocol_handlers_with_protocol_version protocol_handlers = Bolt.protocol_handlers(protocol_version=test_input) assert len(protocol_handlers) == expected
def test_class_method_protocol_handlers_with_invalid_protocol_version(): # python -m pytest tests/unit/io/test_class_bolt.py -s -v -k test_class_method_protocol_handlers_with_invalid_protocol_version with pytest.raises(TypeError): Bolt.protocol_handlers(protocol_version=2)
def test_class_method_protocol_handlers(): # python -m pytest tests/unit/io/test_class_bolt.py -s -v -k test_class_method_protocol_handlers protocol_handlers = Bolt.protocol_handlers() assert len(protocol_handlers) == 2