Merge branch 'master' into topic/dt_feature_search
[sgn.git] / t / legacy / integration / organism / ajax / project_metadata.t
blobdd047d6442e24e2be14a13bda1a782eef7065e7a
1 ## a simple test for the organism ajax functions 
2 ## Lukas Mueller, Jan 2011
4 use lib 't/lib';
5 use Test::Most;
6 use Modern::Perl;
7 use SGN::Test::Data qw/create_test/;
8 use SGN::Test::WWW::Mechanize;
10 my $mech = SGN::Test::WWW::Mechanize->new();
12 $mech->with_test_level( local => sub {
14     my $organism = create_test('Organism::Organism', {
15         genus   => 'test',
16         species => 'test',
17         });
18     my $o_id = $organism->organism_id;
20     # diag("created temp organism $o_id");
22     $mech->get_ok("/organism/$o_id/metadata/?action=view");
24     $mech->content_contains('html');
26     $mech->while_logged_in( { user_type=>'submitter' }, sub {
27         $mech->get_ok("/organism/$o_id/metadata/?action=store&genome_project_funding_agencies=NSF&object_id=-$o_id") or diag $mech->content();
28         $mech->content_contains('success');
29         $mech->get_ok("/organism/$o_id/metadata/?action=view");
30         $mech->content_contains('NSF');
31         $mech->get_ok("/organism/$o_id/metadata/?action=store&genome_project_funding_agencies=USDA&object_id=-$o_id");
32         $mech->content_contains('success');
33         $mech->get_ok("/organism/$o_id/metadata/?action=view");
34         $mech->content_contains('USDA');
35     });
36 });
39 done_testing;