@@ -488,7 +488,14 @@ def test_put_annotation_applies_pipeline_columns(auth_client, session):
488488 config = config ,
489489 status = "SUCCESS" ,
490490 date_executed = datetime (2024 , 1 , 1 , tzinfo = timezone .utc ),
491- result_data = {"string_field" : "demo" , "numeric_field" : 42 },
491+ result_data = {
492+ "string_field" : "demo" ,
493+ "numeric_field" : 42 ,
494+ "array_field" : [
495+ {"name" : "a" },
496+ {"name" : "b" },
497+ ],
498+ },
492499 file_inputs = {},
493500 )
494501 session .add_all ([pipeline , config , result ])
@@ -498,7 +505,7 @@ def test_put_annotation_applies_pipeline_columns(auth_client, session):
498505 "pipelines" : [
499506 {
500507 "name" : pipeline .name ,
501- "columns" : ["string_field" , "numeric_field" ],
508+ "columns" : ["string_field" , "numeric_field" , "name" ],
502509 }
503510 ]
504511 }
@@ -510,6 +517,7 @@ def test_put_annotation_applies_pipeline_columns(auth_client, session):
510517 assert body ["note_keys" ]["existing" ] == "string"
511518 assert body ["note_keys" ]["string_field" ] == "string"
512519 assert body ["note_keys" ]["numeric_field" ] == "number"
520+ assert body ["note_keys" ]["name" ] == "string"
513521
514522 notes = body ["notes" ]
515523 assert len (notes ) == 2
@@ -518,6 +526,7 @@ def test_put_annotation_applies_pipeline_columns(auth_client, session):
518526 assert note ["existing" ] in {"A1" , "A2" }
519527 assert note ["string_field" ] == "demo"
520528 assert note ["numeric_field" ] == 42
529+ assert note ["name" ] == "a,b"
521530
522531
523532def test_put_annotation_pipeline_column_conflict_suffix (auth_client , session ):
@@ -536,7 +545,13 @@ def test_put_annotation_pipeline_column_conflict_suffix(auth_client, session):
536545 config = config_one ,
537546 status = "SUCCESS" ,
538547 date_executed = datetime (2024 , 1 , 1 , tzinfo = timezone .utc ),
539- result_data = {"string_field" : "primary" },
548+ result_data = {
549+ "string_field" : "primary" ,
550+ "array_field" : [
551+ {"name" : "a" },
552+ {"name" : "b" },
553+ ],
554+ },
540555 file_inputs = {},
541556 )
542557
@@ -570,7 +585,7 @@ def test_put_annotation_pipeline_column_conflict_suffix(auth_client, session):
570585
571586 payload = {
572587 "pipelines" : [
573- {"name" : pipeline_one .name , "columns" : ["string_field" ]},
588+ {"name" : pipeline_one .name , "columns" : ["string_field" , "name" ]},
574589 {
575590 "name" : pipeline_two .name ,
576591 "columns" : ["string_field" ],
@@ -590,11 +605,13 @@ def test_put_annotation_pipeline_column_conflict_suffix(auth_client, session):
590605 assert key_two in body ["note_keys" ]
591606 assert body ["note_keys" ][key_one ] == "string"
592607 assert body ["note_keys" ][key_two ] == "string"
608+ assert body ["note_keys" ]["name" ] == "string"
593609
594610 for entry in body ["notes" ]:
595611 note = entry ["note" ]
596612 assert note [key_one ] == "primary"
597613 assert note [key_two ] == "secondary"
614+ assert note ["name" ] == "a,b"
598615
599616
600617def test_annotation_analyses_post (auth_client , ingest_neurosynth , session ):
@@ -629,8 +646,11 @@ def test_annotation_analyses_post(auth_client, ingest_neurosynth, session):
629646 get_resp = auth_client .get (f"/api/annotations/{ annot .json ()['id' ]} " )
630647
631648 assert len (post_resp .json ()) == 2 # third input did not have proper id
632- assert (
633- get_resp .json ()["notes" ][1 ]["note" ]["doo" ]
634- == post_resp .json ()[1 ]["note" ]["doo" ]
635- == new_value
636- )
649+ updated_by_analysis = {
650+ note ["analysis" ]: note ["note" ]["doo" ] for note in post_resp .json ()
651+ }
652+ current_by_analysis = {
653+ note ["analysis" ]: note ["note" ]["doo" ] for note in get_resp .json ()["notes" ]
654+ }
655+ for analysis_id , value in updated_by_analysis .items ():
656+ assert current_by_analysis [analysis_id ] == value == new_value
0 commit comments