Skip to content

Commit

Permalink
Tests: update single trial upload tests
Browse files Browse the repository at this point in the history
update row indices
add csv files to tests
  • Loading branch information
dwaring87 committed Nov 19, 2024
1 parent 1b0730d commit 17239bc
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 126 deletions.
9 changes: 9 additions & 0 deletions t/data/trial/trial_layout_bad_accessions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plot_name,accession_name,plot_number,block_number,is_a_control,rep_number,range_number,row_number,col_number
ba_plot_01,bad_accession1,1,1,0,1,1,1,1
ba_plot_02,bad_accession2,2,1,0,2,1,2,1
ba_plot_03,bad_accession3,3,1,0,1,1,3,1
ba_plot_04,bad_accession4,4,1,1,2,1,4,1
ba_plot_05,bad_accession5,5,2,1,1,2,1,2
ba_plot_06,bad_accession6,6,2,0,2,2,2,2
ba_plot_07,bad_accession7,7,2,0,1,2,3,2
ba_plot_08,bad_accession8,8,2,0,2,2,4,2
9 changes: 9 additions & 0 deletions t/data/trial/trial_layout_example.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plot_name,accession_name,plot_number,block_number,is_a_control,rep_number,range_number,row_number,col_number,seedlot_name,num_seed_per_plot,weight_gram_seed_per_plot
plot_name1,test_accession1,1,1,0,1,1,1,1,,,
plot_name2,test_accession1,2,1,0,2,1,2,1,,,
plot_name3,test_accession2,3,1,0,1,1,3,1,,,
plot_name4,test_accession2,4,1,0,2,1,4,1,,,
plot_name5,test_accession3,5,2,0,1,2,1,2,,,
plot_name6,test_accession3,6,2,0,2,2,2,2,,,
plot_name7,test_accession4,7,2,0,1,2,3,2,,,
plot_name8,test_accession4,8,2,0,2,2,4,2,,,
9 changes: 9 additions & 0 deletions t/data/trial/trial_layout_example_flexible.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
entry_number,accession_name,plot_number,block_number,is_a_control,rep_number,range_number,row_number,col_number
1,test_accession1,1,1,0,1,1,1,1
1,test_accession1,2,1,0,2,1,2,1
2,test_accession2,3,1,0,1,1,3,1
2,test_accession2,4,1,0,2,1,4,1
3,test_accession3,5,2,0,1,2,1,2
3,test_accession3,6,2,0,2,2,2,2
4,test_accession4,7,2,0,1,2,3,2
4,test_accession4,8,2,0,2,2,4,2
9 changes: 9 additions & 0 deletions t/data/trial/trial_layout_example_with_management_factor.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plot_name,accession_name,plot_number,block_number,is_a_control,rep_number,range_number,row_number,col_number,seedlot_name,num_seed_per_plot,weight_gram_seed_per_plot,fert_factor1,manage_factor2
trial_management_factor_plot_name1,test_accession1,1,1,0,1,1,1,1,,,,1,
trial_management_factor_plot_name2,test_accession1,2,1,0,2,1,2,1,,,,1,
trial_management_factor_plot_name3,test_accession2,3,1,0,1,1,3,1,,,,1,1
trial_management_factor_plot_name4,test_accession2,4,1,0,2,1,4,1,,,,,1
trial_management_factor_plot_name5,test_accession3,5,2,0,1,2,1,2,,,,,1
trial_management_factor_plot_name6,test_accession3,6,2,0,2,2,2,2,,,,1,
trial_management_factor_plot_name7,test_accession4,7,2,0,1,2,3,2,,,,1,
trial_management_factor_plot_name8,test_accession4,8,2,0,2,2,4,2,,,,1,
9 changes: 9 additions & 0 deletions t/data/trial/trial_layout_with_seedlot_example.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plot_name,accession_name,plot_number,block_number,is_a_control,rep_number,range_number,row_number,col_number,seedlot_name,num_seed_per_plot,weight_gram_seed_per_plot
plot_with_seedlot_name1,test_accession1,1,1,0,1,1,1,1,test_accession1_001,12,
plot_with_seedlot_name2,test_accession1,2,1,0,2,1,2,1,test_accession1_001,12,
plot_with_seedlot_name3,test_accession2,3,1,0,1,1,3,1,test_accession2_001,12,4
plot_with_seedlot_name4,test_accession2,4,1,0,2,1,4,1,test_accession2_001,12,5
plot_with_seedlot_name5,test_accession3,5,2,0,1,2,1,2,test_accession3_001,12,
plot_with_seedlot_name6,test_accession3,6,2,0,2,2,2,2,test_accession3_001,12,
plot_with_seedlot_name7,test_accession4,7,2,0,1,2,3,2,test_accession4_001,12,
plot_with_seedlot_name8,test_accession4,8,2,0,2,2,4,2,test_accession4_001,12,
11 changes: 9 additions & 2 deletions t/unit_fixture/CXGN/Trial/ParseUpload.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use Data::Dumper;

my $f = SGN::Test::Fixture->new();

for my $extension ("xls", "xlsx") {
for my $extension ("xls", "xlsx", "csv") {

my $p = CXGN::Trial::ParseUpload->new({ filename => "t/data/genotype_trial_upload/CASSAVA_GS_74Template.csv", chado_schema => $f->bcs_schema() });
$p->load_plugin("ParseIGDFile");
Expand Down Expand Up @@ -54,7 +54,14 @@ for my $extension ("xls", "xlsx") {

$results = $p->parse();
$errors = $p->get_parse_errors();
ok($errors->{'error_messages'}->[0] eq "No Excel data found in file", 'check that accessions not in db');
my $expected = {
'error_messages' => [
'Required column stock_name is missing',
'Required column plot_number is missing',
'Required column block_number is missing'
]
};
is_deeply($errors, $expected, 'check file format errors');

$f->clean_up_db();
}
Expand Down
Loading

0 comments on commit 17239bc

Please sign in to comment.