aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2020-05-06 17:14:10 +0100
committerStruan Donald <struan@exo.org.uk>2020-05-12 10:03:01 +0100
commit538a26498c3516b5bc24636414911b955333f934 (patch)
tree89957997794ec834280c1b75cf10c7d752b3f35d /t/app/controller
parent8534d726c54ff5ac130a5b4dda84ff4a2c00482f (diff)
display user detail for contributed_by in report_edit
Include name, email and body rather than just user id.
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/admin/report_edit.t17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/app/controller/admin/report_edit.t b/t/app/controller/admin/report_edit.t
index 438bcc241..01f091412 100644
--- a/t/app/controller/admin/report_edit.t
+++ b/t/app/controller/admin/report_edit.t
@@ -9,6 +9,7 @@ my $user2 = $mech->create_user_ok('test2@example.com', name => 'Test User 2');
my $superuser = $mech->create_user_ok('superuser@example.com', name => 'Super User', is_superuser => 1);
my $oxfordshire = $mech->create_body_ok(2237, 'Oxfordshire County Council');
+my $user3 = $mech->create_user_ok('body_user@example.com', name => 'Body User', from_body => $oxfordshire);
my $oxfordshirecontact = $mech->create_contact_ok( body_id => $oxfordshire->id, category => 'Potholes', email => 'potholes@example.com' );
$mech->create_contact_ok( body_id => $oxfordshire->id, category => 'Traffic lights', email => 'lights@example.com' );
@@ -707,4 +708,20 @@ subtest "Test display of fields extra data" => sub {
$mech->content_contains('Report URL (report_url)</strong>: http://example.com');
};
+subtest "Test display of contributed_as data" => sub {
+ $report->update( { extra => undef } );
+ $mech->get_ok("/admin/report_edit/$report_id");
+ $mech->content_contains('Extra data: No');
+
+ $report->set_extra_metadata( contributed_as => 'another_user' );
+ $report->set_extra_metadata( contributed_by => $user3->id );
+ $report->update;
+
+ $report->discard_changes;
+
+ $mech->get_ok("/admin/report_edit/$report_id");
+ $mech->content_like(qr!Created By</strong>: <a[^>]*>Body User \(@{[ $user3->email ]}!);
+ $mech->content_contains('Created Body</strong>: Oxfordshire County Council');
+};
+
done_testing();