6 use SGN::Test::Fixture;
8 use Test::WWW::Mechanize;
12 use Spreadsheet::Read;
14 my $f = SGN::Test::Fixture->new();
15 my $schema = $f->bcs_schema;
17 my $mech = Test::WWW::Mechanize->new;
20 $mech->post_ok('http://localhost:3010/brapi/v1/token', [ "username"=> "janedoe", "password"=> "secretpw", "grant_type"=> "password" ]);
21 $response = decode_json $mech->content;
22 print STDERR Dumper $response;
23 is($response->{'userDisplayName'}, 'Jane Doe');
26 my $data_level = 'plots';
27 my $selected_columns = encode_json {'plot_name'=>1,'block_number'=>1,'plot_number'=>1,'rep_number'=>1,'row_number'=>1,'col_number'=>1,'accession_name'=>1,'is_a_control'=>1,'pedigree'=>1,'location_name'=>1,'trial_name'=>1,'year'=>1,'synonyms'=>1,'tier'=>1,'seedlot_name'=>1,'seed_transaction_operator'=>1,'num_seed_per_plot'=>1};
30 $mech->post_ok('http://localhost:3010/ajax/fieldbook/create', ['trial_id'=>$trial_id, 'data_level'=>$data_level, 'selected_columns'=>$selected_columns, 'trait_list'=>$trait_list] );
31 $response = decode_json $mech->content;
32 print STDERR Dumper $response;
33 my $file_name = $response->{file};
35 my $contents = ReadData ($file_name);
36 #print STDERR Dumper $contents;
38 my $cells = $contents->[1]->{cell};
39 print STDERR Dumper $cells;
155 'seed_transaction_operator'
164 'test_accession1/test_accession2',
165 'test_accession3/NA',
169 'test_accession1/test_accession2',
170 'test_accession3/NA',
175 'test_accession3/NA',
177 'test_accession1/test_accession2',
242 'test_accession3_synonym1',
243 'test_accession3_synonym1',
244 'test_accession1_synonym1',
247 'test_accession1_synonym1',
248 'test_accession2_synonym1,test_accession2_synonym2',
249 'test_accession3_synonym1',
250 'test_accession1_synonym1',
252 'test_accession2_synonym1,test_accession2_synonym2',
254 'test_accession2_synonym1,test_accession2_synonym2'
275 ], 'test fieldbook ajax file contents');