Permalink
Browse files

Fix tests broken by curator storage changes

  • Loading branch information...
1 parent a7f0714 commit 91ec63350e7c09325f83ad300616b55fe98f9d35 @kimrutherford kimrutherford committed Jan 1, 2013
Showing with 32 additions and 11 deletions.
  1. +5 −2 lib/PomCur/Controller/Curs.pm
  2. +5 −3 lib/PomCur/Curs/State.pm
  3. +7 −1 lib/PomCur/Track/CuratorManager.pm
  4. +15 −5 t/90_curs_controller_actions.t
@@ -133,7 +133,10 @@ sub top : Chained('/') PathPart('curs') CaptureArgs(1)
$st->{annotation_types} = $config->{annotation_types};
$st->{annotation_type_list} = $config->{annotation_type_list};
- my ($state, $submitter_email, $gene_count) = $self->state()->get_state($schema);
+ my ($state, $submitter, $gene_count) = $self->state()->get_state($schema);
+ my $submitter_email = $submitter->{email_address};
+ my $submitter_name = $submitter->{name};
+
$st->{state} = $state;
if ($state eq APPROVAL_IN_PROGRESS) {
@@ -182,7 +185,7 @@ sub top : Chained('/') PathPart('curs') CaptureArgs(1)
if ($state ne SESSION_CREATED) {
$st->{submitter_email} = $submitter_email;
- $st->{submitter_name} = $self->get_metadata($schema, 'submitter_name');
+ $st->{submitter_name} = $submitter_name;
}
$st->{message_to_curators} =
View
@@ -124,7 +124,8 @@ sub get_state
}
my $curs_key = $curs_key_row->value();
- my $submitter_email = $self->curator_manager()->current_curator($curs_key);
+ my ($submitter_email, $submitter_name) =
+ $self->curator_manager()->current_curator($curs_key);
my $state = undef;
my $gene_rs = $self->get_ordered_gene_rs($schema);
@@ -160,7 +161,8 @@ sub get_state
}
}
- return ($state, $submitter_email, $gene_count);
+ return ($state, { email_address => $submitter_email,
+ name => $submitter_name }, $gene_count);
}
=head2
@@ -180,7 +182,7 @@ sub store_statuses
croak "too many arguments for store_statuses()";
}
- my ($status, $submitter_email, $gene_count) = $self->get_state($schema);
+ my ($status, $submitter, $gene_count) = $self->get_state($schema);
my $metadata_rs = $schema->resultset('Metadata');
my $curs_key_row = $metadata_rs->find({ key => 'curs_key' });
@@ -68,7 +68,13 @@ sub current_curator
my $curs_curator_first = $curs_curator_rs->first();
if (defined $curs_curator_first) {
- return $curs_curator_first->curator()->email_address();
+ my $first_curator = $curs_curator_first->curator();
+ if (wantarray) {
+ return ($first_curator->email_address(),
+ $first_curator->name());
+ } else {
+ return $first_curator->email_address();
+ }
} else {
return undef;
}
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 64;
+use Test::More tests => 66;
use Data::Compare;
@@ -115,14 +115,24 @@ test_psgi $app, sub {
my $res = $cb->($req);
is ($res->code, 200);
- like ($res->content(), qr/<div id="curs-assign-session/);
- like ($res->content(), qr/<form action="" method="post">/);
- like ($res->content(), qr/<input name="submitter_name"/);
+ like ($res->content(), qr/<div id="curs-intro/);
+ like ($res->content(), qr/Curate this paper/);
+ }
+
+ # click "Curate this paper"
+ {
+ my $uri = new URI("$root_url/assign_session");
+ my $req = HTTP::Request->new(GET => $uri);
+ my $res = $cb->($req);
+
+ is ($res->code, 200);
+ like ($res->content(), qr/<div id="curs-assign-session"/);
+ like ($res->content(), qr/Curator details/);
}
# test submitting a name and email address
{
- my $uri = new URI("$root_url/");
+ my $uri = new URI("$root_url/assign_session");
$uri->query_form(submitter_email => $test_email,
submitter_name => $test_name,
submit => 'Submit',

0 comments on commit 91ec633

Please sign in to comment.