diff --git a/sgn_test.conf b/sgn_test.conf index cffc38a9f5..e13a989c8e 100644 --- a/sgn_test.conf +++ b/sgn_test.conf @@ -40,6 +40,10 @@ brapi_POST any brapi_PUT any brapi_OPTIONS any +# for drone stuff +python_executable /usr/bin/python3.5 +python_executable_maskrcnn_env /usr/bin/python3.5 + # slurm config backend Slurm diff --git a/t/unit_fixture/CXGN/Stock/MergeStock.t b/t/unit_fixture/CXGN/Stock/MergeStock.t index 4802951050..bb401273e7 100644 --- a/t/unit_fixture/CXGN/Stock/MergeStock.t +++ b/t/unit_fixture/CXGN/Stock/MergeStock.t @@ -10,43 +10,39 @@ use CXGN::Stock; my $f = SGN::Test::Fixture->new(); my $schema = $f->bcs_schema(); -my $dbh = $f->dbh(); -$dbh->begin_work(); +$schema->txn_begin(); eval { my $this_stock_id = 39041; my $other_stock_id = 38844; my $stock = CXGN::Stock->new( { schema => $schema, stock_id => $this_stock_id } ); - + my $initial_counts = get_counts($this_stock_id); # try self merge, should fail: my $error = $stock->merge($this_stock_id); is($error, "Error: cannot merge stock into itself", "merge stock into itself test"); - + my $initial_counts_other = get_counts($other_stock_id); $error = $stock->merge(38844); is($error, 1, "merge stock should give no error"); - + # all data should be transferred, so these need to add up my $combined_counts = get_counts($this_stock_id); - + $initial_counts_other->{prop_count}++; # take added synonym into account foreach my $k (keys %$combined_counts) { print STDERR "Checking key $k...\n"; is($combined_counts->{$k}, ($initial_counts->{$k} + $initial_counts_other->{$k}), "$k test"); - } - - - + } }; print STDERR "ERROR = $@\n"; -$dbh->rollback(); +$schema->txn_rollback(); done_testing(); diff --git a/t/unit_fixture/CXGN/Uploading/Storebrapiobservations.t b/t/unit_fixture/CXGN/Uploading/Storebrapiobservations.t index ba60d9eb2e..b360848c94 100644 --- a/t/unit_fixture/CXGN/Uploading/Storebrapiobservations.t +++ b/t/unit_fixture/CXGN/Uploading/Storebrapiobservations.t @@ -65,7 +65,7 @@ is_deeply($response, { 'metadata' => { 'status' => [ { - 'messageType' => '400', + 'messageType' => 'ERROR', 'message' => 'You must login and have permission to access this BrAPI call.' } ], @@ -129,7 +129,7 @@ is_deeply($response, { 'observationTimeStamp' => '2015-06-16T00:53:26Z', 'germplasmName' => 'test_accession3', 'observationUnitName' => 'test_trial210', - 'uploadedBy' => 41, + 'uploadedBy' => 'collector1', 'collector' => 'collector1', 'germplasmDbId' => 38842, 'observationUnitDbId' => 38866, @@ -143,7 +143,7 @@ is_deeply($response, { 'observationTimeStamp' => '2015-06-16T00:53:26Z', 'germplasmName' => 'test_accession4', 'observationUnitName' => 'test_trial214', - 'uploadedBy' => 41, + 'uploadedBy' => 'collector1', 'collector' => 'collector1', 'germplasmDbId' => 38843, 'observationUnitDbId' => 38870, @@ -179,7 +179,7 @@ is_deeply($response, { }, { 'messageType' => 'INFO', - 'message' => 'All values in your file are now saved in the database!' + 'message' => 'All values in your file have been successfully processed!

2 new values stored
0 previously stored values skipped
0 previously stored values overwritten

' } ], 'pagination' => { diff --git a/t/unit_fixture/CXGN/Uploading/ValidateAllDroneImageryFunctions.t b/t/unit_fixture/CXGN/Uploading/ValidateAllDroneImageryFunctions.t index 3d1475f9f0..fcd1b0df85 100644 --- a/t/unit_fixture/CXGN/Uploading/ValidateAllDroneImageryFunctions.t +++ b/t/unit_fixture/CXGN/Uploading/ValidateAllDroneImageryFunctions.t @@ -531,95 +531,104 @@ print STDERR Dumper $message_hash_remove_image; ok($message_hash_remove_image->{status}); #Testing upload of bulk imaging events -my $bulk_loading_csv = $f->config->{basepath}."/t/data/imagebreed/bulk_loading/BTI_rig_images.xls"; -my $bulk_loading_image_zip = $f->config->{basepath}."/t/data/imagebreed/bulk_loading/BTI_rig_images.zip"; -$ua = LWP::UserAgent->new; -$ua->timeout(3600); -my $response_raster = $ua->post( - 'http://localhost:3010/drone_imagery/upload_drone_imagery_bulk', - Content_Type => 'form-data', - Content => [ - "sgn_session_id"=>$sgn_session_id, - upload_drone_imagery_bulk_images_zipfile => [ $bulk_loading_image_zip, basename($bulk_loading_image_zip) ], - upload_drone_imagery_bulk_imaging_events => [ $bulk_loading_csv, basename($bulk_loading_csv) ], - ] - ); - -ok($response_raster->is_success); -my $message_raster = $response_raster->decoded_content; -print STDERR Dumper $message_raster; -ok($message_raster =~ /Successfully uploaded!/); my $file_previous_geotiff_image_zip = "/home/production/public/static_content/imagebreed/RiceExampleRGBandDSMOrthophotosGeoTIFFs.zip"; my $file_previous_geojson_zip = "/home/production/public/static_content/imagebreed/RiceExampleGeoJSONs.zip"; my $file_previous_imaging_events = "/home/production/public/static_content/imagebreed/RiceExampleRGBandDSMGeoJSONImagingEvent.xls"; -$ua = LWP::UserAgent->new; -$ua->timeout(3600); -my $response_raster = $ua->post( - 'http://localhost:3010/drone_imagery/upload_drone_imagery_bulk_previous', - Content_Type => 'form-data', - Content => [ - "sgn_session_id"=>$sgn_session_id, - upload_drone_imagery_bulk_images_zipfile_previous => [ $file_previous_geotiff_image_zip, basename($file_previous_geotiff_image_zip) ], - upload_drone_imagery_bulk_geojson_zipfile_previous => [ $file_previous_geojson_zip, basename($file_previous_geojson_zip) ], - upload_drone_imagery_bulk_imaging_events_previous => [ $file_previous_imaging_events, basename($file_previous_imaging_events) ], - ] - ); +my $bulk_loading_csv = $f->config->{basepath}."/t/data/imagebreed/bulk_loading/BTI_rig_images.xls"; +my $bulk_loading_image_zip = $f->config->{basepath}."/t/data/imagebreed/bulk_loading/BTI_rig_images.zip"; -ok($response_raster->is_success); -my $message_raster = $response_raster->decoded_content; -print STDERR Dumper $message_raster; -ok($message_raster =~ /Successfully uploaded!/); -my $rasterblue = $f->config->{basepath}."/t/data/imagebreed/RasterBlue.png"; -my $rastergreen = $f->config->{basepath}."/t/data/imagebreed/RasterGreen.png"; -my $rasterred= $f->config->{basepath}."/t/data/imagebreed/RasterRed.png"; -my $rasternir = $f->config->{basepath}."/t/data/imagebreed/RasterNIR.png"; -my $rasterrededge = $f->config->{basepath}."/t/data/imagebreed/RasterRedEdge.png"; -$ua = LWP::UserAgent->new; -$ua->timeout(3600); -my $response_raster = $ua->post( - 'http://localhost:3010/drone_imagery/upload_drone_imagery', - Content_Type => 'form-data', - Content => [ - "sgn_session_id"=>$sgn_session_id, - "drone_run_field_trial_id"=>$field_trial_id, - "drone_run_name"=>"NewStitchedMicasense5BandDroneRunProjectTESTING", - "drone_run_type"=>"Aerial Medium to High Res", - "drone_run_date"=>"2019/02/01 13:14:15", - "drone_run_description"=>"test new drone run", - "drone_image_upload_camera_info"=>"micasense_5", - "drone_run_imaging_vehicle_id"=>$new_vehicle_id, - "drone_run_imaging_vehicle_battery_name"=>"blue", - "drone_image_upload_drone_run_band_stitching"=>"no", - "drone_run_band_number"=>5, - "drone_run_band_name_1"=>"NewStitchedMicasense5BandDroneRunProjectTESTING_Blue", - "drone_run_band_description_1"=>"raster blue", - "drone_run_band_type_1"=>"Blue (450-520nm)", - drone_run_band_stitched_ortho_image_1 => [ $rasterblue, basename($rasterblue) ], - "drone_run_band_name_2"=>"NewStitchedMicasense5BandDroneRunProjectTESTING_Green", - "drone_run_band_description_2"=>"raster green", - "drone_run_band_type_2"=>"Green (515-600nm)", - drone_run_band_stitched_ortho_image_2 => [ $rastergreen, basename($rastergreen) ], - "drone_run_band_name_3"=>"NewStitchedMicasense5BandDroneRunProjectTESTING_Red", - "drone_run_band_description_3"=>"raster red", - "drone_run_band_type_3"=>"Red (600-690nm)", - drone_run_band_stitched_ortho_image_3 => [ $rasterred, basename($rasterred) ], - "drone_run_band_name_4"=>"NewStitchedMicasense5BandDroneRunProjectTESTING_NIR", - "drone_run_band_description_4"=>"raster NIR", - "drone_run_band_type_4"=>"NIR (780-3000nm)", - drone_run_band_stitched_ortho_image_4 => [ $rasternir, basename($rasternir) ], - "drone_run_band_name_5"=>"NewStitchedMicasense5BandDroneRunProjectTESTING_RedEdge", - "drone_run_band_description_5"=>"raster rededge", - "drone_run_band_type_5"=>"Red Edge (690-750nm)", - drone_run_band_stitched_ortho_image_5 => [ $rasterrededge, basename($rasterrededge) ], - ] - ); + SKIP: { + skip 'Some required files not available for these tests', 6, unless ( (-e $file_previous_geotiff_image_zip) && (-e $file_previous_geojson_zip) && (-e $file_previous_imaging_events) && (-e $bulk_loading_csv) && (-e $bulk_loading_image_zip)); -ok($response_raster->is_success); -my $message_raster = $response_raster->decoded_content; -print STDERR Dumper $message_raster; -ok($message_raster =~ /Successfully uploaded!/); + $ua = LWP::UserAgent->new; + $ua->timeout(3600); + my $response_raster = $ua->post( + 'http://localhost:3010/drone_imagery/upload_drone_imagery_bulk', + Content_Type => 'form-data', + Content => [ + "sgn_session_id"=>$sgn_session_id, + upload_drone_imagery_bulk_images_zipfile => [ $bulk_loading_image_zip, basename($bulk_loading_image_zip) ], + upload_drone_imagery_bulk_imaging_events => [ $bulk_loading_csv, basename($bulk_loading_csv) ], + ] + ); + + ok($response_raster->is_success); + my $message_raster = $response_raster->decoded_content; + print STDERR Dumper $message_raster; + ok($message_raster =~ /Successfully uploaded!/); + + + $ua = LWP::UserAgent->new; + $ua->timeout(3600); + my $response_raster = $ua->post( + 'http://localhost:3010/drone_imagery/upload_drone_imagery_bulk_previous', + Content_Type => 'form-data', + Content => [ + "sgn_session_id"=>$sgn_session_id, + upload_drone_imagery_bulk_images_zipfile_previous => [ $file_previous_geotiff_image_zip, basename($file_previous_geotiff_image_zip) ], + upload_drone_imagery_bulk_geojson_zipfile_previous => [ $file_previous_geojson_zip, basename($file_previous_geojson_zip) ], + upload_drone_imagery_bulk_imaging_events_previous => [ $file_previous_imaging_events, basename($file_previous_imaging_events) ], + ] + ); + + ok($response_raster->is_success); + my $message_raster = $response_raster->decoded_content; + print STDERR Dumper $message_raster; + ok($message_raster =~ /Successfully uploaded!/); + + my $rasterblue = $f->config->{basepath}."/t/data/imagebreed/RasterBlue.png"; + my $rastergreen = $f->config->{basepath}."/t/data/imagebreed/RasterGreen.png"; + my $rasterred= $f->config->{basepath}."/t/data/imagebreed/RasterRed.png"; + my $rasternir = $f->config->{basepath}."/t/data/imagebreed/RasterNIR.png"; + my $rasterrededge = $f->config->{basepath}."/t/data/imagebreed/RasterRedEdge.png"; + $ua = LWP::UserAgent->new; + $ua->timeout(3600); + my $response_raster = $ua->post( + 'http://localhost:3010/drone_imagery/upload_drone_imagery', + Content_Type => 'form-data', + Content => [ + "sgn_session_id"=>$sgn_session_id, + "drone_run_field_trial_id"=>$field_trial_id, + "drone_run_name"=>"NewStitchedMicasense5BandDroneRunProjectTESTING", + "drone_run_type"=>"Aerial Medium to High Res", + "drone_run_date"=>"2019/02/01 13:14:15", + "drone_run_description"=>"test new drone run", + "drone_image_upload_camera_info"=>"micasense_5", + "drone_run_imaging_vehicle_id"=>$new_vehicle_id, + "drone_run_imaging_vehicle_battery_name"=>"blue", + "drone_image_upload_drone_run_band_stitching"=>"no", + "drone_run_band_number"=>5, + "drone_run_band_name_1"=>"NewStitchedMicasense5BandDroneRunProjectTESTING_Blue", + "drone_run_band_description_1"=>"raster blue", + "drone_run_band_type_1"=>"Blue (450-520nm)", + drone_run_band_stitched_ortho_image_1 => [ $rasterblue, basename($rasterblue) ], + "drone_run_band_name_2"=>"NewStitchedMicasense5BandDroneRunProjectTESTING_Green", + "drone_run_band_description_2"=>"raster green", + "drone_run_band_type_2"=>"Green (515-600nm)", + drone_run_band_stitched_ortho_image_2 => [ $rastergreen, basename($rastergreen) ], + "drone_run_band_name_3"=>"NewStitchedMicasense5BandDroneRunProjectTESTING_Red", + "drone_run_band_description_3"=>"raster red", + "drone_run_band_type_3"=>"Red (600-690nm)", + drone_run_band_stitched_ortho_image_3 => [ $rasterred, basename($rasterred) ], + "drone_run_band_name_4"=>"NewStitchedMicasense5BandDroneRunProjectTESTING_NIR", + "drone_run_band_description_4"=>"raster NIR", + "drone_run_band_type_4"=>"NIR (780-3000nm)", + drone_run_band_stitched_ortho_image_4 => [ $rasternir, basename($rasternir) ], + "drone_run_band_name_5"=>"NewStitchedMicasense5BandDroneRunProjectTESTING_RedEdge", + "drone_run_band_description_5"=>"raster rededge", + "drone_run_band_type_5"=>"Red Edge (690-750nm)", + drone_run_band_stitched_ortho_image_5 => [ $rasterrededge, basename($rasterrededge) ], + ] + ); + + ok($response_raster->is_success); + my $message_raster = $response_raster->decoded_content; + print STDERR Dumper $message_raster; + ok($message_raster =~ /Successfully uploaded!/); +}; + done_testing(); diff --git a/t/unit_fixture/CXGN/Uploading/ValidateNIRS.t b/t/unit_fixture/CXGN/Uploading/ValidateNIRS.t index 056302485b..f4297af764 100644 --- a/t/unit_fixture/CXGN/Uploading/ValidateNIRS.t +++ b/t/unit_fixture/CXGN/Uploading/ValidateNIRS.t @@ -82,7 +82,7 @@ my $message_hash = decode_json $message; print STDERR Dumper $message_hash; ok($message_hash->{figure}); is(scalar(@{$message_hash->{success}}), 8); -is($message_hash->{success}->[6], 'All values in your file are now saved in the database!'); +like($message_hash->{success}->[6], qr/All values in your file have been successfully processed!/, "return message test"); my $nirs_protocol_id = $message_hash->{nd_protocol_id}; my $ds = CXGN::Dataset->new( people_schema => $f->people_schema(), schema => $f->bcs_schema()); diff --git a/t/unit_fixture/CXGN/VerifyDeletion/TrialDeletion.t b/t/unit_fixture/CXGN/VerifyDeletion/TrialDeletion.t index 1c06c81dfb..1f8300d10a 100644 --- a/t/unit_fixture/CXGN/VerifyDeletion/TrialDeletion.t +++ b/t/unit_fixture/CXGN/VerifyDeletion/TrialDeletion.t @@ -63,6 +63,9 @@ print STDERR Dumper $response; is_deeply($response, {'success' => 1}); $mech->get_ok('http://localhost:3010/ajax/breeders/trial/'.$project_id.'/delete/layout'); + +sleep(30); # deletion script takes time... (?) + $response = decode_json $mech->content; print STDERR Dumper $response; is_deeply($response, {'message' => 'Successfully deleted trial data.','success' => 1}, 'test trial layout + entry deletion');