def end_connection(self, session: Session, cluster: Cluster): """ Disconnecting thr session and cluster :param session: session object (obtained from cassandra-driver) :param cluster: cluster object (obtained from cassandra-driver) :return: """ session.shutdown() cluster.shutdown()
def test_session_host_parameter(self): """ Test for protocol negotiation Very that NoHostAvailable is risen in Session.__init__ when there are no valid connections and that no error is arisen otherwise, despite maybe being some invalid hosts @since 3.9 @jira_ticket PYTHON-665 @expected_result NoHostAvailable when the driver is unable to connect to a valid host, no exception otherwise @test_category connection """ with self.assertRaises(NoHostAvailable): Session(Cluster(protocol_version=PROTOCOL_VERSION), []) with self.assertRaises(NoHostAvailable): Session(Cluster(protocol_version=PROTOCOL_VERSION), [Host("1.2.3.4", SimpleConvictionPolicy)]) session = Session(Cluster(protocol_version=PROTOCOL_VERSION), [Host(x, SimpleConvictionPolicy) for x in ("127.0.0.1", "127.0.0.2", "1.2.3.4")]) session.shutdown()