def test_post_search_expressions_name_threshold(test_client): """ post_search_expressions """ _, _, sample_expression, context = test_client with context: # min Expression feature ID h5 format result, code = operations.post_search_expressions({ 'version': Version, 'tags': ['test'], 'minExpression': [{'featureID': 'ENSG00000000003', 'threshold': 0.1}, {'featureID': 'ENSG00000000005', 'threshold': 0.2}] }) assert len(result) == 1 assert result[0]['fileType'] == 'h5' assert code == 200 # min Expression feature no threshold match result, code = operations.post_search_expressions({ 'version': Version, 'tags': ['test'], 'minExpression': [{'featureID': 'ENSG00000000003', 'threshold': 1000}, {'featureID': 'ENSG00000000005', 'threshold': 1000}] }) assert not result assert code == 200
def test_post_search_expressions_error_threshold(test_client): """ post_search_expressions """ _, _, sample_expression, context = test_client with context: # threshold error result, code = operations.post_search_expressions({ 'format': 'json', 'minExpression': [{ 'featureName': 'TSPAN6', 'threshold': 0.1 }, { 'featureID': 'ENSG00000000005', 'threshold': 0.2 }] }) assert (code == 400) # threshold error result, code = operations.post_search_expressions({ 'format': 'json', 'minExpression': [{ 'invalid': 'TSPAN6' }, { 'invalid': 'ENSG00000000005', 'threshold': 2.0 }] }) assert (code == 400)
def test_post_search_expressions_error_uuid(test_client): """ post_search_expressions """ _, _, sample_expression, context = test_client with context: # uuid error (400) result, code = operations.post_search_expressions({ 'studyID': 'not a uuid', }) assert len(result) == 0 assert code == 200
def test_post_search_expressions_id_threshold(test_client): """ post_search_expressions """ _, _, sample_expression, context = test_client with context: # max Expression feature name json format result, code = operations.post_search_expressions({ 'format': 'json', 'minExpression': [{'featureName': 'TSPAN6', 'threshold': 0.1}, {'featureName': 'TNMD', 'threshold': 0.2}] }) assert len(result) == 1 assert result[0]['fileType'] == 'json' assert code == 200