def test_credentials_but_no_secrets(self): with self.assertRaises(TypeError): cluster_from_config({ "cassandra.contact_points": "127.0.0.1", "cassandra.credentials_secret": "secret/foo/bar", })
def test_port(self): cluster = cluster_from_config({ "cassandra.contact_points": "127.0.1.1", "cassandra.port": "9999" }) self.assertEqual(cluster.port, 9999)
def test_credentials(self): secrets = mock.Mock(autospec=SecretsStore) cluster = cluster_from_config( { "cassandra.contact_points": "127.0.0.1", "cassandra.credentials_secret": "secret/foo/bar", }, secrets=secrets, ) self.assertIsNotNone(cluster.auth_provider)
def test_alternate_prefix(self): cluster = cluster_from_config( {"noodle.contact_points": "127.0.1.1, 127.0.1.2"}, prefix="noodle.") self.assertEqual(cluster.contact_points, ["127.0.1.1", "127.0.1.2"])
def test_kwarg_passthrough(self): cluster = cluster_from_config( {"cassandra.contact_points": "127.0.0.1"}, protocol_version=3) self.assertEqual(cluster.protocol_version, 3)
def test_contact_points(self): cluster = cluster_from_config( {"cassandra.contact_points": "127.0.1.1, 127.0.1.2"}) self.assertEqual(cluster.contact_points, ["127.0.1.1", "127.0.1.2"])
def test_empty_config(self): with self.assertRaises(ConfigurationError): cluster_from_config({})