Skip to content

Commit

Permalink
Fixing unit test metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
timparsons committed Oct 10, 2023
1 parent a980726 commit 7c6d0c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions t/unit_mech/AJAX/_BrAPIv2_core.t
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@ my $study_id = $column->max();

print STDERR "STUDY ID = $study_id\n";

is_deeply($response, {'result' => {'data' => [{'observationLevels' => undef,'dataLinks' => [],'experimentalDesign' => {'PUI' => 'RCBD','description' => 'RCBD'},'observationUnitsDescription' => undef,'studyName' => 'Observation at Kenya 1','startDate' => undef,'growthFacility' => undef,'active' => JSON::true,'lastUpdate' => undef,'contacts' => undef,'endDate' => undef,'studyDbId' => $study_id,'locationDbId' => '23','documentationURL' => '','additionalInfo' => {'programDbId' => '134','programName' => 'test'},'seasons' => ['2018'],'culturalPractices' => undef,'studyDescription' => 'This is a yield study for Spring 2018','externalReferences' => [],'studyPUI' => undef,'commonCropName' => 'Cassava','trialDbId' => $trial_id,'studyType' => 'nonexisting_type','trialName' => 'Peru Yield Trial 2010','locationName' => 'test_location','license' => undef,'studyCode' => undef,'environmentParameters' => undef}]},'metadata' => {'datafiles' => [],'pagination' => {'totalCount' => 1,'currentPage' => 0,'pageSize' => 10,'totalPages' => 1},'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=10','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v2::Studies'},{'message' => 'Studies stored successfully','messageType' => 'INFO'}]}} );
is_deeply($response, {'result' => {'data' => [{'observationLevels' => undef,'dataLinks' => [],'experimentalDesign' => {'PUI' => 'RCBD','description' => 'RCBD'},'observationUnitsDescription' => undef,'studyName' => 'Observation at Kenya 1','startDate' => undef,'growthFacility' => undef,'active' => JSON::true,'lastUpdate' => undef,'contacts' => undef,'endDate' => undef,'studyDbId' => $study_id,'locationDbId' => '23','documentationURL' => '','additionalInfo' => {'programDbId' => '134','programName' => 'test'},'seasons' => ['2018'],'culturalPractices' => undef,'studyDescription' => 'This is a yield study for Spring 2018','externalReferences' => [],'studyPUI' => undef,'commonCropName' => 'Cassava','trialDbId' => $trial_id,'studyType' => 'nonexisting_type','trialName' => 'Peru Yield Trial 2010','locationName' => 'test_location','license' => undef,'studyCode' => undef,'environmentParameters' => undef}]},'metadata' => {'datafiles' => [],'pagination' => {'totalCount' => 1,'currentPage' => 0,'pageSize' => 1,'totalPages' => 1},'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=10','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v2::Studies'},{'message' => 'Studies stored successfully','messageType' => 'INFO'}]}} );

$data = '{ "active": "true", "additionalInfo": {}, "commonCropName": "Grape", "contacts": [], "culturalPractices": "Irrigation was applied according needs during summer to prevent water stress.", "dataLinks": [], "documentationURL": "http://breedbase.org", "endDate": "2018-01-01", "environmentParameters": [ { "description": "the soil type was clay", "parameterName": "soil type", "parameterPUI": "PECO:0007155", "unit": "pH", "unitPUI": "PECO:0007059", "value": "clay soil", "valuePUI": "ENVO:00002262" } ], "experimentalDesign": { "PUI": "CRD", "description": "Lines were repeated twice at each location using a complete block design. In order to limit competition effects, each block was organized into four sub-blocks corresponding to earliest groups based on a prior information." }, "externalReferences": [], "growthFacility": { "PUI": "CO_715:0000162", "description": "field environment condition, greenhouse" }, "lastUpdate": { "timestamp": "2018-01-01T14:47:23-0600", "version": "1.2.3" }, "license": "MIT License", "locationDbId": "23", "locationName": "test_location", "observationLevels": [], "observationUnitsDescription": "Observation units consisted in individual plots themselves consisting of a row of 15 plants at a density of approximately six plants per square meter.", "seasons": [ "Spring_2018" ], "startDate": "2018-01-01", "studyCode": "Grape_Yield_Spring_2018", "studyDescription": "This is a yield study for Spring 2018", "studyName": "INRAs Walnut Genetic Resources Observation at Kenya modified", "studyPUI": "doi:10.155454/12349537312", "studyType": "phenotyping_trial", "trialDbId": "'. $trial_id .'", "trialName": "Peru Yield Trial 2010"}';
$resp = $ua->put("http://localhost:3010/brapi/v2/studies/".$study_id, Content => $data);
$response = decode_json $resp->{_content};
print STDERR "\n\nSTUDIES PUT" . Dumper $response;
is_deeply($response, {'result' => {'culturalPractices' => undef,'studyDescription' => 'This is a yield study for Spring 2018','externalReferences' => [],'studyPUI' => undef,'commonCropName' => 'Cassava','trialDbId' => $trial_id,'studyType' => 'phenotyping_trial','additionalInfo' => {'programName' => 'test','programDbId' => '134'},'seasons' => ['Spring_2018'],'environmentParameters' => undef,'trialName' => 'Peru Yield Trial 2010','locationName' => 'test_location','studyCode' => undef,'license' => undef,'observationUnitsDescription' => undef,'studyName' => 'INRAs Walnut Genetic Resources Observation at Kenya modified','startDate' => '2018-01-01T00:00:00Z','growthFacility' => undef,'active' => JSON::true,'lastUpdate' => undef,'observationLevels' => undef,'dataLinks' => [],'experimentalDesign' => {'PUI' => 'CRD','description' => 'CRD'},'locationDbId' => '23','documentationURL' => '','contacts' => undef,'endDate' => '2018-01-01T00:00:00Z','studyDbId' => $study_id},'metadata' => {'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=0, pageSize=10'},{'message' => 'Loading CXGN::BrAPI::v2::Studies','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Studies result constructed'}],'datafiles' => [],'pagination' => {'totalCount' => 1,'totalPages' => 1,'pageSize' => 10,'currentPage' => 0}}} );
is_deeply($response, {'result' => {'culturalPractices' => undef,'studyDescription' => 'This is a yield study for Spring 2018','externalReferences' => [],'studyPUI' => undef,'commonCropName' => 'Cassava','trialDbId' => $trial_id,'studyType' => 'phenotyping_trial','additionalInfo' => {'programName' => 'test','programDbId' => '134'},'seasons' => ['Spring_2018'],'environmentParameters' => undef,'trialName' => 'Peru Yield Trial 2010','locationName' => 'test_location','studyCode' => undef,'license' => undef,'observationUnitsDescription' => undef,'studyName' => 'INRAs Walnut Genetic Resources Observation at Kenya modified','startDate' => '2018-01-01T00:00:00Z','growthFacility' => undef,'active' => JSON::true,'lastUpdate' => undef,'observationLevels' => undef,'dataLinks' => [],'experimentalDesign' => {'PUI' => 'CRD','description' => 'CRD'},'locationDbId' => '23','documentationURL' => '','contacts' => undef,'endDate' => '2018-01-01T00:00:00Z','studyDbId' => $study_id},'metadata' => {'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=0, pageSize=10'},{'message' => 'Loading CXGN::BrAPI::v2::Studies','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Studies result constructed'}],'datafiles' => [],'pagination' => {'totalCount' => 1,'totalPages' => 1,'pageSize' => 1,'currentPage' => 0}}} );

# print STDERR "Checking put with Kasese trial...\n";
# #
Expand Down

0 comments on commit 7c6d0c5

Please sign in to comment.