aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/moderate.t25
-rw-r--r--t/app/controller/report_import.t17
2 files changed, 41 insertions, 1 deletions
diff --git a/t/app/controller/moderate.t b/t/app/controller/moderate.t
index c2ac3ad5a..c3aba0ebb 100644
--- a/t/app/controller/moderate.t
+++ b/t/app/controller/moderate.t
@@ -4,6 +4,12 @@ use parent 'FixMyStreet::Cobrand::Default';
sub send_moderation_notifications { 0 }
+package FixMyStreet::Cobrand::TestTitle;
+
+use parent 'FixMyStreet::Cobrand::Default';
+
+sub moderate_permission_title { 0 }
+
package main;
use FixMyStreet::TestMech;
@@ -208,6 +214,25 @@ subtest 'Problem moderation' => sub {
$report->update({ state => 'confirmed' });
}
};
+
+ subtest 'Try and moderate title when not allowed' => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => 'testtitle'
+ }, sub {
+ $mech->get_ok($REPORT_URL);
+ $mech->submit_form_ok({ with_fields => {
+ problem_show_name => 1,
+ problem_photo => 1,
+ problem_detail => 'Changed detail',
+ }});
+ $mech->base_like( qr{\Q$REPORT_URL\E} );
+ $mech->content_like(qr/Moderated by Bromley Council/);
+
+ $report->discard_changes;
+ is $report->title, 'Good bad good';
+ is $report->detail, 'Changed detail';
+ }
+ };
};
$mech->content_lacks('Posted anonymously', 'sanity check');
diff --git a/t/app/controller/report_import.t b/t/app/controller/report_import.t
index e4a202db7..223979d1b 100644
--- a/t/app/controller/report_import.t
+++ b/t/app/controller/report_import.t
@@ -89,6 +89,15 @@ subtest "Test creating bad partial entries" => sub {
};
+for my $test (
+ {
+ desc => 'Submit a correct entry',
+ },
+ {
+ desc => 'Submit a correct web entry',
+ web => 1,
+ }
+) {
subtest "Submit a correct entry" => sub {
$mech->get_ok('/import');
@@ -101,13 +110,18 @@ subtest "Submit a correct entry" => sub {
subject => 'Test report',
detail => 'This is a test report',
photo => $sample_file,
+ web => $test->{web},
}
},
"fill in form"
);
is_deeply( $mech->import_errors, [], "got no errors" );
- is $mech->content, 'SUCCESS', "Got success response";
+ if ( $test->{web} ) {
+ $mech->content_contains('Nearly done! Now check', "Got email confirmation page");
+ } else {
+ is $mech->content, 'SUCCESS', "Got success response";
+ }
# check that we have received the email
my $token_url = $mech->get_link_from_email;
@@ -223,6 +237,7 @@ subtest "Submit a correct entry" => sub {
$mech->delete_user($user);
};
+}
subtest "Submit a correct entry (with location)" => sub {