Esempio n. 1
0
 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",
         })
Esempio n. 2
0
    def test_port(self):
        cluster = cluster_from_config({
            "cassandra.contact_points": "127.0.1.1",
            "cassandra.port": "9999"
        })

        self.assertEqual(cluster.port, 9999)
Esempio n. 3
0
 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)
Esempio n. 4
0
    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"])
Esempio n. 5
0
    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)
Esempio n. 6
0
    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"])
Esempio n. 7
0
 def test_empty_config(self):
     with self.assertRaises(ConfigurationError):
         cluster_from_config({})