aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-09-11 13:27:22 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-10-25 14:07:13 +0100
commit3a149039167145ef6d8cd0218a30ec8d98741bc4 (patch)
treefe7bb66dbbf0e015bf1ee94cf0d40d9b2c42e8bf /t/app/controller
parent4a49ae1152800d65955df92efece935f1a673fcf (diff)
Allow editing of category name.
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/admin/bodies.t17
1 files changed, 16 insertions, 1 deletions
diff --git a/t/app/controller/admin/bodies.t b/t/app/controller/admin/bodies.t
index 75f0f606f..cd86e3da6 100644
--- a/t/app/controller/admin/bodies.t
+++ b/t/app/controller/admin/bodies.t
@@ -51,7 +51,7 @@ subtest 'check contact creation' => sub {
non_public => 'on',
} } );
$mech->get_ok('/admin/body/' . $body->id . '/test/category');
- $mech->content_contains('<h1>test/category</h1>');
+ $mech->content_contains('test/category');
};
subtest 'check contact editing' => sub {
@@ -91,6 +91,21 @@ subtest 'check contact editing' => sub {
$mech->content_contains( '<td><strong>test2@example.com' );
};
+subtest 'check contact renaming' => sub {
+ my ($report) = $mech->create_problems_for_body(1, $body->id, 'Title', { category => 'test category' });
+ $mech->get_ok('/admin/body/' . $body->id .'/test%20category');
+ $mech->submit_form_ok( { with_fields => { category => 'private category' } } );
+ $mech->content_contains('You cannot rename');
+ $mech->submit_form_ok( { with_fields => { category => 'testing category' } } );
+ $mech->content_contains( 'testing category' );
+ $mech->get('/admin/body/' . $body->id . '/test%20category');
+ is $mech->res->code, 404;
+ $mech->get_ok('/admin/body/' . $body->id . '/testing%20category');
+ $report->discard_changes;
+ is $report->category, 'testing category';
+ $mech->submit_form_ok( { with_fields => { category => 'test category' } } );
+};
+
subtest 'check contact updating' => sub {
$mech->get_ok('/admin/body/' . $body->id . '/test%20category');
$mech->content_like(qr{test2\@example.com</strong>[^<]*</td>[^<]*<td>unconfirmed}s);