1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-06-09 06:41:19 +03:00
mariadb-AlanMologorsky a079a2c944 MCOL-5496: Merge CMAPI code to engine repo.
[add] cmapi code to engine
2023-06-07 10:00:16 +03:00

36 lines
1.2 KiB
Python

"""Tests for all the CEJ (Cross Engine Join) related stuff."""
import os
import subprocess
import sys
import unittest
from shutil import which
from cmapi_server.handlers.cej import CEJPasswordHandler
from cmapi_server.constants import MCS_SECRETS_FILE_PATH
class SecretsTestCase(unittest.TestCase):
"""Test case for checking .secrets file related stuff."""
@unittest.skipIf(which('cskeys') is None,
'This MCS version doesn\'t provide "cskeys" tool.')
def test_cspasswd_decrypt_algorithm(self) -> None:
"""Test to check decrypt algorithm.
Check that CEJ password decrypting algorithm is the same between
"cspasswd" tool in MCS and in CMAPI.
"""
test_passwd = 'columstore is the best'
# create .secrets file using cskeys util
ret = subprocess.run(
'cskeys', shell=True, stdout=subprocess.PIPE, check=True
)
encrypted_passwd = subprocess.check_output(
['cspasswd', test_passwd]
).decode(sys.stdout.encoding).strip()
self.assertEqual(
test_passwd, CEJPasswordHandler.decrypt_password(encrypted_passwd)
)
os.remove(MCS_SECRETS_FILE_PATH)