Commit 2bf8e676 authored by Ryan Herbert's avatar Ryan Herbert

Merge branch 'feature-s/init_public_tags' into 'dev'

vidjil_utils.py add default tags to db init

See merge request !335
parents a875fcd2 6d6a5164
Pipeline #44759 passed with stages
in 5 minutes and 48 seconds
......@@ -696,3 +696,29 @@ def init_db_helper(db, auth, force=False, admin_email="plop@plop.com", admin_pas
auth.add_permission(id_public_group, PermissionEnum.read_pre_process.value, db.pre_process, 0)
for pre_process in db(db.pre_process.id > 0).select():
auth.add_permission(id_public_group, PermissionEnum.access.value, db.pre_process, pre_process.id)
tags = ['ALL', 'T-ALL', 'B-ALL',
'pre-B-ALL','pro-B-ALL', 'mature-B-ALL',
'CML', 'HCL', 'MZL', 'T-PLL',
'CLL', 'LGL',
'lymphoma',
'MCL', 'NHL', 'HL', 'FL', 'DLBCL',
'WM', 'MAG',
'MM',
'diagnosis', 'MRD', 'relapse', 'CR', 'deceased',
'pre-BMT', 'post-BMT', 'pre-SCT', 'post-SCT',
'dilution', 'standard',
'QC', 'EuroMRD',
'marrow', 'blood',
'repertoire',
'TIL', 'CAR-T', 'scFv',
'FR1', 'FR2', 'FR3',
'TRA', 'TRB', 'TRG', 'TRD',
'IGH', 'IGK', 'KDE', 'IGL',
'IKAROS',
'BCR-ABL', 'TEL-AML1', 'E2A-PBX',
'BCL2',
'PAX5']
for tag in tags:
tid = db.tag.insert(name=tag)
db.group_tag.insert(group_id=id_public_group, tag_id=tid)
......@@ -37,10 +37,12 @@ class TagController(unittest.TestCase):
resp = auto_complete()
self.assertNotEqual(resp.find("missing group ids"), -1, "auto_complete did not fail correctly")
expected ={"3": [{"id": 1, "name": "ALL"}, {"id": 2, "name": "T-ALL"}, {"id": 3, "name": "B-ALL"}, {"id": 4, "name": "pre-B-ALL"}, {"id": 5, "name": "pro-B-ALL"}, {"id": 6, "name": "mature-B-ALL"}, {"id": 7, "name": "CML"}, {"id": 8, "name": "HCL"}, {"id": 9, "name": "MZL"}, {"id": 10, "name": "T-PLL"}, {"id": 11, "name": "CLL"}, {"id": 12, "name": "LGL"}, {"id": 13, "name": "lymphoma"}, {"id": 14, "name": "MCL"}, {"id": 15, "name": "NHL"}, {"id": 16, "name": "HL"}, {"id": 17, "name": "FL"}, {"id": 18, "name": "DLBCL"}, {"id": 19, "name": "WM"}, {"id": 20, "name": "MAG"}, {"id": 21, "name": "MM"}, {"id": 22, "name": "diagnosis"}, {"id": 23, "name": "MRD"}, {"id": 24, "name": "relapse"}, {"id": 25, "name": "CR"}, {"id": 26, "name": "deceased"}, {"id": 27, "name": "pre-BMT"}, {"id": 28, "name": "post-BMT"}, {"id": 29, "name": "pre-SCT"}, {"id": 30, "name": "post-SCT"}, {"id": 31, "name": "dilution"}, {"id": 32, "name": "standard"}, {"id": 33, "name": "QC"}, {"id": 34, "name": "EuroMRD"}, {"id": 35, "name": "marrow"}, {"id": 36, "name": "blood"}, {"id": 37, "name": "repertoire"}, {"id": 38, "name": "TIL"}, {"id": 39, "name": "CAR-T"}, {"id": 40, "name": "scFv"}, {"id": 41, "name": "FR1"}, {"id": 42, "name": "FR2"}, {"id": 43, "name": "FR3"}, {"id": 44, "name": "TRA"}, {"id": 45, "name": "TRB"}, {"id": 46, "name": "TRG"}, {"id": 47, "name": "TRD"}, {"id": 48, "name": "IGH"}, {"id": 49, "name": "IGK"}, {"id": 50,"name": "KDE"}, {"id": 51, "name": "IGL"}, {"id": 52, "name": "IKAROS"}, {"id": 53, "name": "BCR-ABL"}, {"id": 54, "name": "TEL-AML1"}, {"id": 55, "name": "E2A-PBX"}, {"id": 56, "name": "BCL2"}, {"id": 57, "name": "PAX5"}]}
request.vars["keys"] = "[]"
resp = auto_complete()
self.assertEqual(resp.find("missing group ids"), -1, "auto_complete failed to detect group_ids param")
self.assertEqual(resp, "{}", "auto_complete returned an unexpected response")
self.assertEqual(json.loads(resp), expected, "auto_complete returned an unexpected response")
request.vars["keys"] = "[%d,%d]" % (unique_group, fake_group_id)
resp = auto_complete()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment