Skip to content

Commit 4c965e9

Browse files
committed
self.ca_cert
1 parent fa2f65d commit 4c965e9

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

qiita_client/qiita_client.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,16 @@
2828
logger = logging.getLogger(__name__)
2929

3030
JOB_COMPLETED = False
31-
MAX_RETRIES = 3
32-
MIN_TIME_SLEEP = 1
33-
MAX_TIME_SLEEP = 3
31+
# if the log level is DEBUG we should never expect slow response so let's
32+
# make the retries as small as posible
33+
if logger.level == logging.DEBUG:
34+
MAX_RETRIES = 1
35+
MIN_TIME_SLEEP = 1
36+
MAX_TIME_SLEEP = 2
37+
else:
38+
MAX_RETRIES = 3
39+
MIN_TIME_SLEEP = 180
40+
MAX_TIME_SLEEP = 3
3441
BLANK_FILE_THRESHOLD = 100
3542

3643

qiita_client/tests/test_qiita_client.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,15 @@ def test_format_payload_error(self):
9797

9898
class QiitaClientTests(PluginTestCase):
9999
def setUp(self):
100+
self.ca_cert = environ['QIITA_ROOT_CA']
100101
self.tester = QiitaClient("https://localhost:21174",
101102
CLIENT_ID,
102-
CLIENT_SECRET)
103+
CLIENT_SECRET,
104+
self.ca_cert)
103105
self.bad_tester = QiitaClient("https://localhost:21174",
104106
BAD_CLIENT_ID,
105-
CLIENT_SECRET)
107+
CLIENT_SECRET,
108+
self.ca_cert)
106109
self.clean_up_files = []
107110

108111
# making assertRaisesRegex compatible with Python 2.7 and 3.9
@@ -118,11 +121,11 @@ def test_init(self):
118121
obs = QiitaClient("https://localhost:21174",
119122
CLIENT_ID,
120123
CLIENT_SECRET,
121-
ca_cert=environ['QIITA_ROOT_CA'])
124+
ca_cert=self.ca_cert)
122125
self.assertEqual(obs._server_url, "https://localhost:21174")
123126
self.assertEqual(obs._client_id, CLIENT_ID)
124127
self.assertEqual(obs._client_secret, CLIENT_SECRET)
125-
self.assertEqual(obs._verify, environ['QIITA_ROOT_CA'])
128+
self.assertEqual(obs._verify, self.ca_cert)
126129

127130
def test_get(self):
128131
obs = self.tester.get("/qiita_db/artifacts/1/")

0 commit comments

Comments
 (0)