@@ -528,8 +528,8 @@ def test_create_experiment_that_keyword_gene_ontology_has_valid_code(client, set
528528 "keywords" : [
529529 {
530530 "keyword" : {
531- "key" : "Phenotypic Assay Mechanism" ,
532- "label" : "Label " ,
531+ "key" : "Molecular Mechanism Assessed " ,
532+ "label" : "Sodium channel activity " ,
533533 "code" : "GO:1234567" ,
534534 "special" : False ,
535535 "description" : "Description" ,
@@ -541,8 +541,8 @@ def test_create_experiment_that_keyword_gene_ontology_has_valid_code(client, set
541541 response = client .post ("/api/v1/experiments/" , json = experiment )
542542 assert response .status_code == 200
543543 response_data = response .json ()
544- assert response_data ["keywords" ][0 ]["keyword" ]["key" ] == "Phenotypic Assay Mechanism"
545- assert response_data ["keywords" ][0 ]["keyword" ]["label" ] == "Label "
544+ assert response_data ["keywords" ][0 ]["keyword" ]["key" ] == "Molecular Mechanism Assessed "
545+ assert response_data ["keywords" ][0 ]["keyword" ]["label" ] == "Sodium channel activity "
546546 assert response_data ["keywords" ][0 ]["keyword" ]["code" ] == "GO:1234567"
547547
548548
@@ -551,7 +551,7 @@ def test_create_experiment_that_keyword_gene_ontology_is_other_without_code(clie
551551 "keywords" : [
552552 {
553553 "keyword" : {
554- "key" : "Phenotypic Assay Mechanism" ,
554+ "key" : "Molecular Mechanism Assessed " ,
555555 "label" : "Other" ,
556556 "code" : None ,
557557 "description" : "Description" ,
@@ -564,17 +564,60 @@ def test_create_experiment_that_keyword_gene_ontology_is_other_without_code(clie
564564 response = client .post ("/api/v1/experiments/" , json = experiment )
565565 assert response .status_code == 200
566566 response_data = response .json ()
567- assert response_data ["keywords" ][0 ]["keyword" ]["key" ] == "Phenotypic Assay Mechanism"
567+ assert response_data ["keywords" ][0 ]["keyword" ]["key" ] == "Molecular Mechanism Assessed "
568568 assert response_data ["keywords" ][0 ]["keyword" ]["label" ] == "Other"
569569
570570
571+ def test_create_experiment_that_keywords_has_multiple_molecular_mechanism_assessed_labels (client , setup_router_db ):
572+ valid_keywords = {
573+ "keywords" : [
574+ {
575+ "keyword" : {
576+ "key" : "Molecular Mechanism Assessed" ,
577+ "label" : "Sodium channel activity" ,
578+ "code" : "GO:1234567" ,
579+ "special" : False ,
580+ "description" : "Description" ,
581+ },
582+ },
583+ {
584+ "keyword" : {
585+ "key" : "Molecular Mechanism Assessed" ,
586+ "label" : "Calcium-mediated signaling" ,
587+ "code" : "GO:1134567" ,
588+ "special" : False ,
589+ "description" : "Description" ,
590+ },
591+ }
592+ ],
593+ }
594+ experiment = {** TEST_MINIMAL_EXPERIMENT , ** valid_keywords }
595+ response = client .post ("/api/v1/experiments/" , json = experiment )
596+ assert response .status_code == 200
597+ response_data = response .json ()
598+ assert len (response_data ["keywords" ]) == 2
599+ labels = {kw ["keyword" ]["label" ] for kw in response_data ["keywords" ]}
600+ codes = {kw ["keyword" ]["code" ] for kw in response_data ["keywords" ]}
601+ keys = {kw ["keyword" ]["key" ] for kw in response_data ["keywords" ]}
602+
603+ assert keys == {"Molecular Mechanism Assessed" }
604+ assert labels == {
605+ "Sodium channel activity" ,
606+ "Calcium-mediated signaling" ,
607+ }
608+ assert codes == {
609+ "GO:1234567" ,
610+ "GO:1134567" ,
611+ }
612+
613+
571614# TODO(#511) Re-enable the Gene Ontology code requirement.
572615# def test_cannot_create_experiment_that_keyword_has_an_invalid_code(client, setup_router_db):
573616# invalid_keyword = {
574617# "keywords": [
575618# {
576619# "keyword": {
577- # "key": "Phenotypic Assay Mechanism",
620+ # "key": "Molecular Mechanism Assessed ",
578621# "label": "Label",
579622# "code": "invalid",
580623# "description": "Description",
0 commit comments