diff --git a/.github/workflows/qiita-ci.yml b/.github/workflows/qiita-ci.yml index 2eda5c8..f0bb7e5 100644 --- a/.github/workflows/qiita-ci.yml +++ b/.github/workflows/qiita-ci.yml @@ -86,7 +86,7 @@ jobs: shell: bash -l {0} run: | conda activate qiita - export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_server.crt + export QIITA_ROOTCA_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_rootca.crt export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" `pwd`/qiita-dev/qiita_core/support_files/config_test.cfg > ${QIITA_CONFIG_FP} @@ -118,8 +118,7 @@ jobs: COVER_PACKAGE: ${{ matrix.cover_package }} run: | conda activate qiita_client - export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_server.crt - export QIITA_ROOT_CA=`pwd`/qiita-dev/qiita_core/support_files/ci_rootca.crt + export QIITA_ROOTCA_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_rootca.crt export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg export PYTHONWARNINGS="ignore:Certificate for localhost has no \`subjectAltName\`" - uses: codecov/codecov-action@v3 diff --git a/README.md b/README.md index c4677ba..7dfeedf 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ This package includes the Qiita Client utility library, a library to simplify th How to test this package? ------------------------- In order to test the Qiita Client package, a local installation of Qiita should be running in test mode on the address `https://localhost:21174`, with the default test database created in Qiita's test suite. -Also, if Qiita is running with the default server SSL certificate, you need to export the variable `QIITA_SERVER_CERT` in your environment, so the Qiita Client can perform secure connections against the Qiita server: +Also, if Qiita is running with the default server SSL certificate, you need to export the variable `QIITA_ROOTCA_CERT` in your environment, so the Qiita Client can perform secure connections against the Qiita server: ```bash -export QIITA_SERVER_CERT=/qiita_core/support_files/server.crt +export QIITA_ROOT_CA=/qiita_core/support_files/ci_rootca.crt ``` diff --git a/qiita_client/plugin.py b/qiita_client/plugin.py index e2c6c0d..c41ea42 100644 --- a/qiita_client/plugin.py +++ b/qiita_client/plugin.py @@ -250,7 +250,7 @@ def __call__(self, server_url, job_id, output_dir): # this value will prevent underlying libraries # from validating the server's cert using # certifi's pem cache. - ca_cert=environ['QIITA_ROOT_CA']) + ca_cert=environ['QIITA_ROOTCA_CERT']) if job_id == 'register': self._register(qclient) diff --git a/qiita_client/qiita_client.py b/qiita_client/qiita_client.py index 0942ed4..c697d46 100644 --- a/qiita_client/qiita_client.py +++ b/qiita_client/qiita_client.py @@ -57,7 +57,7 @@ def __init__(self, output_name, artifact_type, files, archive=None): def __eq__(self, other): logger.debug('Entered ArtifactInfo.__eq__()') - if type(self) != type(other): # noqa + if type(self) is not type(other): return False if self.output_name != other.output_name or \ self.artifact_type != other.artifact_type or \ diff --git a/qiita_client/tests/test_qiita_client.py b/qiita_client/tests/test_qiita_client.py index 3f5d66c..17184e1 100644 --- a/qiita_client/tests/test_qiita_client.py +++ b/qiita_client/tests/test_qiita_client.py @@ -7,7 +7,7 @@ # ----------------------------------------------------------------------------- from unittest import TestCase, main -from os import remove, close +from os import remove, close, environ from os.path import basename, exists from tempfile import mkstemp from json import dumps @@ -97,7 +97,6 @@ def test_format_payload_error(self): class QiitaClientTests(PluginTestCase): def setUp(self): - # self.server_cert = environ.get('QIITA_SERVER_CERT', None) self.tester = QiitaClient("https://localhost:21174", CLIENT_ID, CLIENT_SECRET) @@ -116,11 +115,14 @@ def tearDown(self): remove(fp) def test_init(self): - obs = QiitaClient("https://localhost:21174", CLIENT_ID, CLIENT_SECRET) + obs = QiitaClient("https://localhost:21174", + CLIENT_ID, + CLIENT_SECRET, + ca_cert=environ['QIITA_ROOT_CA']) self.assertEqual(obs._server_url, "https://localhost:21174") self.assertEqual(obs._client_id, CLIENT_ID) self.assertEqual(obs._client_secret, CLIENT_SECRET) - self.assertEqual(obs._verify, True) + self.assertEqual(obs._verify, environ['QIITA_ROOT_CA']) def test_get(self): obs = self.tester.get("/qiita_db/artifacts/1/") diff --git a/rootca_insert.py b/rootca_insert.py deleted file mode 100644 index 59d12e5..0000000 --- a/rootca_insert.py +++ /dev/null @@ -1,18 +0,0 @@ -import certifi -from sys import argv - - -def main(ca_fp): - with open(ca_fp, 'rb') as f: - my_ca = f.read() - - ca_file = certifi.where() - - with open(ca_file, 'ab') as f: - f.write(my_ca) - - print("%s updated" % ca_file) - - -if __name__ == '__main__': - main(argv[1])