Skip to content

Commit fcf78b9

Browse files
committed
add test by project
1 parent 5654f0a commit fcf78b9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

microsetta_private_api/admin/tests/test_admin_api.py

+22
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,28 @@ def test_query_barcode_stats_multiple_projects(self):
12811281
# content: should have exactly the same projects
12821282
self.assertEqual(response_projects[1], response_projects[2])
12831283

1284+
def test_query_barcode_stats_by_project(self):
1285+
input_json = json.dumps({'project_id': 19}) # expect 5 barcodes
1286+
exp_barcodes = [
1287+
'000035369', '000035370', '000035371',
1288+
'000035372', '000035373'
1289+
]
1290+
1291+
response = self.client.post(
1292+
"api/admin/account_barcode_summary?strip_sampleid=False",
1293+
content_type='application/json',
1294+
data=input_json,
1295+
headers=MOCK_HEADERS
1296+
)
1297+
# an empty string project should be unknown
1298+
self.assertEqual(200, response.status_code)
1299+
1300+
response_obj = json.loads(response.data)
1301+
self.assertIn('samples', response_obj)
1302+
response_obj = response_obj['samples']
1303+
self.assertEqual(len(response_obj), 5)
1304+
self.assertEqual([v['sampleid'] for v in response_obj], exp_barcodes)
1305+
12841306
def test_send_email(self):
12851307
def mock_func(*args, **kwargs):
12861308
pass

0 commit comments

Comments
 (0)