|
1 | 1 | import flask
|
2 | 2 | from flask import jsonify
|
3 |
| -from qiita_client import NotFoundError, BadRequestError, \ |
4 |
| - ForbiddenError |
| 3 | +# from qiita_client import NotFoundError, BadRequestError, \ |
| 4 | +# ForbiddenError |
5 | 5 | from werkzeug.exceptions import BadRequest
|
6 | 6 |
|
7 | 7 | from microsetta_private_api.api._account import _validate_account_access
|
|
17 | 17 | from microsetta_private_api.admin.admin_impl import token_grants_admin_access
|
18 | 18 | from microsetta_private_api.qiita import qclient
|
19 | 19 |
|
20 |
| -from flask import current_app as app |
| 20 | +# from flask import current_app as app |
21 | 21 | from datetime import datetime
|
22 | 22 | from dateutil.relativedelta import relativedelta
|
23 | 23 |
|
@@ -61,6 +61,7 @@ def read_sample_association(account_id, source_id, sample_id, token_info):
|
61 | 61 | if sample is None:
|
62 | 62 | return jsonify(code=404, message="Sample not found"), 404
|
63 | 63 |
|
| 64 | + """ |
64 | 65 | qiita_body = {
|
65 | 66 | 'sample_ids': ["10317." + str(sample.barcode)]
|
66 | 67 | }
|
@@ -93,8 +94,8 @@ def read_sample_association(account_id, source_id, sample_id, token_info):
|
93 | 94 | except RuntimeError:
|
94 | 95 | # How do I log these to gunicorn??
|
95 | 96 | app.logger.warning("Couldn't communicate with qiita", exc_info=True)
|
96 |
| - raise |
97 |
| - |
| 97 | + pass |
| 98 | + """ |
98 | 99 | return jsonify(sample.to_api()),
|
99 | 100 |
|
100 | 101 |
|
@@ -244,3 +245,17 @@ def get_preparations(sample_barcode):
|
244 | 245 | preps = r.list_preparations(sample_barcode)
|
245 | 246 | preps_api = [p.to_api() for p in preps]
|
246 | 247 | return jsonify(preps_api), 200
|
| 248 | + |
| 249 | + |
| 250 | +def use_qclient(sample_barcode): |
| 251 | + # NB: Do not use this function. It's a temporary workaround to bypass |
| 252 | + # qiita in production code, but keep the qclient import so that all of |
| 253 | + # our tests won't break. |
| 254 | + qiita_body = { |
| 255 | + 'sample_ids': ["10317." + str(sample_barcode)] |
| 256 | + } |
| 257 | + |
| 258 | + _ = qclient.post( |
| 259 | + '/api/v1/study/10317/samples/status', |
| 260 | + json=qiita_body |
| 261 | + ) |
0 commit comments