6 use SGN::Test::Fixture;
8 use Test::WWW::Mechanize;
11 #Needed to update IO::Socket::SSL
14 local $Data::Dumper::Indent = 0;
16 my $f = SGN::Test::Fixture->new();
17 my $schema = $f->bcs_schema;
18 my $dbh = $schema->storage->dbh;
19 my $people_schema = $f->people_schema;
21 my $mech = Test::WWW::Mechanize->new;
23 $mech->post_ok('http://localhost:3010/brapi/v1/token', [ "username"=> "janedoe", "password"=> "secretpw", "grant_type"=> "password" ]);
24 my $response = decode_json $mech->content;
25 print STDERR Dumper $response;
26 is($response->{'metadata'}->{'status'}->[2]->{'message'}, 'Login Successfull');
27 my $sgn_session_id = $response->{access_token};
28 print STDERR $sgn_session_id."\n";
30 print STDERR "Uploading File to Data Dump for Sharing\n";
32 my $file = $f->config->{basepath}."/t/data/genotype_data/testset_GT-AD-DP-GQ-DS-PL.vcf";
34 my $ua = LWP::UserAgent->new;
35 $response = $ua->post(
36 'http://localhost:3010/ajax/filesharedump/upload',
37 Content_Type => 'form-data',
39 manage_file_dump_upload_file_dialog_file => [ $file, 'manage_file_dump_upload_file_dialog_file' ],
40 "sgn_session_id"=>$sgn_session_id,
44 #print STDERR Dumper $response;
45 ok($response->is_success);
46 my $message = $response->decoded_content;
47 my $message_hash = decode_json $message;
48 print STDERR Dumper $message_hash;
49 is_deeply($message_hash, {success=>1});
51 my $ua = LWP::UserAgent->new;
52 $response = $ua->get("http://localhost:3010/ajax/filesharedump/list?sgn_session_id=$sgn_session_id");
53 $message = $response->decoded_content;
54 $message_hash = decode_json $message;
55 print STDERR Dumper $message_hash;
56 is(scalar(@{$message_hash->{data}}), 1);