Skip to content

Commit

Permalink
Updated based on discussions
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cowart committed Jul 22, 2024
1 parent 8b036e2 commit e55a895
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 29 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/qiita-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_INSTALL_PATH>/qiita_core/support_files/server.crt
export QIITA_ROOT_CA=<QIITA_INSTALL_PATH>/qiita_core/support_files/ci_rootca.crt
```
2 changes: 1 addition & 1 deletion qiita_client/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion qiita_client/qiita_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
10 changes: 6 additions & 4 deletions qiita_client/tests/test_qiita_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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/")
Expand Down
18 changes: 0 additions & 18 deletions rootca_insert.py

This file was deleted.

0 comments on commit e55a895

Please sign in to comment.