mirror of
https://github.com/getredash/redash.git
synced 2025-12-21 18:35:48 -05:00
* feat: provide ssl options for Cassandra data source * remove Log and prints * Refactor to create module methods and unit tests * Switch to using Enumerator and temp file * Fix temporary file lifecycle for cert * Align with changes on master * Fix non certificate but ssl enabled usecase
23 lines
750 B
Python
23 lines
750 B
Python
import shutil
|
|
import ssl
|
|
from unittest import TestCase
|
|
|
|
from redash.query_runner.cass import generate_ssl_options_dict
|
|
|
|
|
|
class TestCassandra(TestCase):
|
|
|
|
def test_generate_ssl_options_dict_creates_plain_protocol_dict(self):
|
|
expected = {'ssl_version': ssl.PROTOCOL_TLSv1_2}
|
|
actual = generate_ssl_options_dict("PROTOCOL_TLSv1_2")
|
|
self.assertDictEqual(expected, actual)
|
|
|
|
def test_generate_ssl_options_dict_creates_certificate_dict(self):
|
|
expected = {
|
|
'ssl_version': ssl.PROTOCOL_TLSv1_2,
|
|
'ca_certs': 'some/path',
|
|
'cert_reqs': ssl.CERT_REQUIRED,
|
|
}
|
|
actual = generate_ssl_options_dict("PROTOCOL_TLSv1_2", "some/path")
|
|
self.assertDictEqual(expected, actual)
|