def test_get_trial_details(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 1, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ { "trialDbId": 1, "trialName": "Peru Yield Trial", "programDbId": 1, "name": "CIPHQ", "startDate": "2013-01-01", "endDate": "2013-07-05", "active": false, "studies": [] } ] } }""" test_get(self, '/brapi/v1/trials/1', expected)
def test_get_types(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageSize": 100, "totalCount": 3, "pageTotal": 1 }, "datafiles": [], "status": [] }, "result": { "data": [ { "name": "Crossing Nursery", "description": "Description for Nursery study type" }, { "name": "Yield Trial", "description": "Description for Trial study type" }, { "name": "Genotype", "description": "Description for Genotyping study type" } ] } }""" test_get(self, '/brapi/v1/studyTypes/', expected)
def test_get_trait_details(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 1, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ { "traitDbId": 1, "traitId": "CO_334:0100620", "name": "Carotenoid content", "description": "Cassava storage root pulp carotenoid content", "observationVariables": [ "CO_334:0100621", "CO_334:0100623", "CO_334:0100623" ] } ] } }""" test_get(self, '/brapi/v1/traits/1', expected)
def test_get_programs(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 3, "totalCount": 6, "pageSize": 2 }, "status": [], "datafiles": [] }, "result": { "data": [ { "programDbId": 1, "name": "CIPHQ", "abbreviation": "CIPHQ", "objective": "Global Population Improvement", "leadPerson": "G. Leader" }, { "programDbId": 2, "name": "Ghana", "abbreviation": "GHA", "objective": "OFSP", "leadPerson": "M. Breeder" } ] } }""" test_get(self, '/brapi/v1/programs/?pageSize=2', expected)
def test_get_allele_matrices(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 2, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ { "name": "testDs1", "matrixDbId": 27, "description": "a test dataset", "lastUpdated": "2017-06-12", "studyDbId": 13 }, { "name": "testDs2", "matrixDbId": 28, "description": "a second test dataset", "lastUpdated": "2017-06-12", "studyDbId": 13 } ] } }""" test_get(self, '/brapi/v1/allelematrices/', expected)
def test_get_markerprofiles_data(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 1, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ { "markerProfilesDbId": 3, "uniqueDisplayName": "germplasm3", "sampleDbId": 33, "extractDbId": 1, "studyDbId": 1, "analysisMethod": "GBS", "resultCount": 1, "germplasmDbId": 3 } ] } }""" test_get(self, '/brapi/v1/markerprofiles/3/', expected)
def test_get_datatypes(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 6, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ "Numeric", "Categorical", "Date", "Text", "Picture", "Boolean" ] } }""" test_get(self, '/brapi/v1/variables/datatypes/', expected)
def test_get_obs_unit_details(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageSize": 100, "totalCount": 1, "pageTotal": 1 }, "datafiles": [], "status": [] }, "result": { "data": [ { "studyDbId": 1, "observationDbId": 3383838, "observationUnitDbId": 11, "observationUnitName": "ZIPA_68_Ibadan_2014", "observationLevel": "plot", "observationVariableDbId": 393939, "observationVariableName": "Yield", "observationTimestamp": "2015-11-05T14:12:56Z", "uploadedBy": "dbUserId", "operator": "Jane Doe", "germplasmDbId": 8383, "germplasmName": 143, "value": 5 } ] } }""" test_get(self, '/brapi/v1/studies/1/observationunits/', expected)
def test_get_seasons(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageSize": 2, "totalCount": 10, "pageTotal": 5 }, "datafiles": [], "status": [] }, "result": { "data": [ { "seasonDbId": 1, "season": "spring", "year": 2011 }, { "seasonDbId": 2, "season": "summer", "year": 2011 } ] } }""" test_get(self, '/brapi/v1/seasons/?pageSize=2', expected)
def test_get_germplasm_attr_avail(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 1, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ { "attributeCategoryDbId": 1, "code": "RHT", "uri": "http://www.cropontology.org/rdf/CO_321:0000020", "name": "Rht-B1b", "description": "Allele of marker 11_4769, diagnostic for allele b of reduced-height gene Rht-B1''", "datatype": "Categorical", "values": [ "Present", "Absent", "Heterozygous" ] } ] } }""" test_get(self, '/brapi/v1/attributes/', expected)
def test_get_germplasm_attr_cats(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 2, "totalCount": 3, "pageSize": 2 }, "status": [], "datafiles": [] }, "result": { "data": [ { "attributeCategoryDbId": 1, "name": "Morphological" }, { "attributeCategoryDbId": 2, "name": "Agronomic" } ] } }""" test_get(self, '/brapi/v1/attributes/categories/?pageSize=2', expected)
def test_get_map_data_by_range(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 2, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ { "markerDbId": 1, "markerName": "m1", "location": 10, "linkageGroupId": 1 }, { "markerDbId": 2, "markerName": "m2", "location": 20, "linkageGroupId": 1 } ] } }""" test_get(self, '/brapi/v1/maps/1/positions/1?min=10&max=20', expected)
def test_get_markers(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 3, "totalCount": 5, "pageSize": 2 }, "status": [], "datafiles": [] }, "result": { "data": [ { "markerDbId": 1, "defaultDisplayName": "a_01_10001", "type": "SNP", "synonyms": [ "i_01_10001", "popA_10001" ], "refAlt": [ "A", "T" ], "analysisMethods": [ "illumina" ] }, { "markerDbId": 2, "defaultDisplayName": "A_01_10002", "type": "SNP", "synonyms": [ "i_01_10001", "popA_10002" ], "refAlt": [ "G", "C" ], "analysisMethods": [ "illumina" ] } ] } }""" test_get(self, '/brapi/v1/markers/?pageSize=2', expected)
def test_get_trials(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 5, "totalCount": 9, "pageSize": 2 }, "status": [], "datafiles": [] }, "result": { "data": [ { "additionalInfo": { "values": { "donorName": "Donor1", "specialProject": "Project1" } }, "trialDbId": 1, "trialName": "Peru Yield Trial", "programDbId": 1, "name": "CIPHQ", "startDate": "2013-01-01", "endDate": "2013-07-05", "active": false, "studies": [] }, { "additionalInfo": null, "trialDbId": 2, "trialName": "Peru Genotype Trial", "programDbId": 1, "name": "CIPHQ", "startDate": "2014-06-01", "endDate": "2015-01-15", "active": false, "studies": [] } ] } }""" test_get(self, '/brapi/v1/trials/?pageSize=2', expected)
def test_get_location_details(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 1, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ { "latitude": -11.1275, "countryName": "Peru", "abbreviation": "CIPSRM-1", "instituteName": "INRA - GDEC", "longitude": -75.356389, "altitude": "828", "instituteAdress": "route foo, Clermont Ferrand, France", "locationType": "Storage location", "additionalInfo": { "values": { " local": "San Ramon", "crops": "potato,sweetpotato", "cont": "South America", "creg": "LAC", "adm3": "San Ramon", "adm2": "Chanchamayo", "adm1": "Junin", "annualTotalPrecipitation": "360", "annualMeanTemperature": "23" } }, "locationDbId": 1, "countryCode": "PER", "name": "Experimental station San Ramon (CIP)" } ] } }""" test_get(self, '/brapi/v1/locations/1/', expected)
def test_get_plot_layout_details(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageSize": 2, "totalCount": 6, "pageTotal": 3 }, "datafiles": [], "status": [] }, "result": { "data": [ { "studyDbId": 1, "observationUnitDbId": 10001, "observationUnitName": "ZIPA_68_Ibadan_2014", "observationLevel": "plot", "replicate": 1, "germplasmDbId": 101, "germplasmName": "ZIPA_68", "blockNumber": 1, "X": 1, "Y": 1, "entryType": "test" }, { "studyDbId": 1, "observationUnitDbId": 10002, "observationUnitName": "ZIPA_69_Ibadan_2014", "observationLevel": "plot", "replicate": 1, "germplasmDbId": 102, "germplasmName": "ZIPA_69", "blockNumber": 1, "X": 2, "Y": 1, "entryType": "test" } ] } }""" test_get(self, '/brapi/v1/studies/1/layout/?pageSize=2', expected)
def test_get_map(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 1, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ { "mapDbId": 1, "name": "SSR map 1", "type": "Genetic", "unit": "cM", "linkageGroups": [ { "linkageGroupId": 1, "markerCount": 21, "maxPosition": 50 }, { "linkageGroupId": 2, "markerCount": 12, "maxPosition": 100 }, { "linkageGroupId": 3, "markerCount": 7, "maxPosition": 90 } ] } ] } }""" test_get(self, '/brapi/v1/maps/1/', expected)
def test_get_germplasm_attrs(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 3, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ { "attributeDbId": 1, "attributeName": "Morphological", "attributeCode": "FLSHORG", "value": "Present", "dateDetermined": "2016-01-01" }, { "attributeDbId": 2, "attributeName": "Agronomic", "attributeCode": "RHT", "value": "Absent", "dateDetermined": "2016-01-01" }, { "attributeDbId": 3, "attributeName": "Biotic stress", "attributeCode": "WEV", "value": "Present", "dateDetermined": "2016-01-01" } ] } }""" test_get(self, '/brapi/v1/germplasm/1/attributes', expected)
def test_get_samples(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 1, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ { "studyDbId": "StudyId-123", "locationDbId": "LocationId-123", "plotId": "PlotId-123", "plantId": "PlantID-123", "sampleId": "Unique-Plant-SampleID", "takenBy": "Mr. Technician", "sampleTimestamp": "2016-07-27T13:43:22Z", "sampleType": "TypeOfSample", "tissueType": "TypeOfTissue", "notes": "Cut from infected leaf", "studyName": "Yield Trial A", "season": "Summer", "locationName": "Kenya", "entryNumber": 11, "plotNumber": 1, "germplasmDbId": 15, "plantingTimestamp": "2016-01-01T22:22:21Z", "harvestTimestamp": "2016-06-30T22:33:23Z" } ] } }""" test_get(self, '/brapi/v1/samples/Unique-Plant-SampleID', expected)
def test_get_calls(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 25, "totalCount": 50, "pageSize": 2 }, "status": [], "datafiles": [] }, "result": { "data": [ { "call": "token", "datatypes": [ "json", "text" ], "methods": [ "POST", "DELETE" ] }, { "call": "calls", "datatypes": [ "json" ], "methods": [ "GET" ] } ] } }""" test_get(self, '/brapi/v1/calls?pageSize=2', expected)
def test_get_maps(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 2, "totalCount": 3, "pageSize": 2 }, "status": [], "datafiles": [] }, "result": { "data": [ { "mapDbId": 1, "name": "SSR map 1", "species": "Ipomoea batatas", "type": "Genetic", "unit": "cM", "publishedDate": "2016-01-06", "comments": "", "linkageGroupCount": 10 }, { "mapDbId": 2, "name": "SSR map 2", "species": "Ipomoea trifida", "type": "Genetic", "unit": "cM", "publishedDate": "2016-11-15", "comments": "none", "linkageGroupCount": 10 } ] } }""" test_get(self, '/brapi/v1/maps/?pageSize=2', expected)
def test_get_allele_matrix_search(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 4, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ [ "1", "1", "A/B" ], [ "1", "2", "B" ], [ "2", "1", "A" ], [ "2", "2", "A/B" ] ] } }""" test_get(self, '/brapi/v1/allelematrix-search', expected)
def test_get_obs_levels(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageSize": 100, "totalCount": 2, "pageTotal": 1 }, "datafiles": [], "status": [] }, "result": { "data": [ "plant", "plot" ] } }""" test_get(self, '/brapi/v1/observationLevels/', expected)
def test_get_crops(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 2, "totalCount": 4, "pageSize": 2 }, "status": [], "datafiles": [] }, "result": { "data": [ "cassava", "potato" ] } }""" test_get(self, '/brapi/v1/crops/?pageSize=2', expected)
def test_get_ontologies(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 3, "totalCount": 5, "pageSize": 2 }, "status": [], "datafiles": [] }, "result": { "data": [ { "ontologyDbId": "CO_334", "ontologyName": "Wheat ontology", "authors": "J. Snow, H. Peterson", "version": "v1.2", "copyright": "2016, INRA", "licence": "CC BY-SA 4.0" }, { "ontologyDbId": "CO_334", "ontologyName": "Wheat ontology", "authors": "J. Snow, H. Peterson", "version": "v1.2", "copyright": "2016, INRA", "licence": "CC BY-SA 4.0" } ] } }""" test_get(self, '/brapi/v1/ontologies/?pageSize=2', expected)
def test_get_variable_details(self): expected = """ { "metadata": { "pagination": { "currentPage": 1, "pageTotal": 1, "totalCount": 1, "pageSize": 100 }, "status": [], "datafiles": [] }, "result": { "data": [ { "method": { "methodDbId": "CO_334:0010320", "name": "Visual Rating:total carotenoid by chart_method", "classe": "Estimation", "description": "Assessment of the level of yellowness in cassava storage root pulp using the tc chart", "formula": "", "reference": "" }, "trait": { "traitDbId": "CO_334:0100620", "name": "Carotenoid content", "classe": "physiological trait", "description": "Cassava storage root pulp carotenoid content", "synonyms": "carotenoid content measure", "mainAbbreviation": "CC", "alternativeAbbreviations": "CCS", "entity": "root", "attribute": "carotenoid", "status": "recommended", "xref": "TL_455:0003023", "uniqueDisplayName": "", "extractDbId": null, "markerprofileDbId": null, "analysisMethod": "", "data": "" }, "scale": { "validValues": { "categories": [ "1" ], "min": 2, "max": 2 }, "scaleDbId": "CO_334:0100526", "name": "ug/g", "datatype": "Numeric", "decimalPlaces": "0", "xref": null }, "observationVariableDbId": "CO_334:0100622", "name": "caro_spectro", "ontologyDbId": "CO_334", "ontologyName": "Cassava", "synonyms": "Carotenoid content by spectro", "contextOfUse": "Trial evaluation; Nursery evaluation", "growthStage": "mature", "status": "recommended", "xref": "TL_455:0003001", "institution": null, "scientist": null, "date": "2016-05-13", "language": "EN", "crop": "cassava", "defaultValue": "2" } ] } }""" test_get(self, '/brapi/v1/variables/CO_334:0100622/', expected)