aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/moderate.t3
-rw-r--r--t/app/controller/questionnaire.t6
-rw-r--r--t/app/controller/report_inspect.t4
-rw-r--r--t/app/controller/report_updates.t6
4 files changed, 13 insertions, 6 deletions
diff --git a/t/app/controller/moderate.t b/t/app/controller/moderate.t
index 0ccfcf2c2..3a3c7a708 100644
--- a/t/app/controller/moderate.t
+++ b/t/app/controller/moderate.t
@@ -67,7 +67,8 @@ subtest 'Auth' => sub {
$mech->get_ok($REPORT_URL);
$mech->content_lacks('Moderat');
- $mech->get_ok('/contact?m=1&id=' . $report->id);
+ $mech->get('/contact?m=1&id=' . $report->id);
+ is $mech->res->code, 400;
$mech->content_lacks('Good bad bad bad');
};
diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t
index b05f74225..f42908a3e 100644
--- a/t/app/controller/questionnaire.t
+++ b/t/app/controller/questionnaire.t
@@ -87,16 +87,19 @@ foreach my $test (
desc => 'User goes to questionnaire URL with a bad token',
token_extra => 'BAD',
content => "Sorry, that wasn’t a valid link",
+ code => 400,
},
{
desc => 'User goes to questionnaire URL for a now-hidden problem',
state => 'hidden',
content => "we couldn't locate your problem",
+ code => 400,
},
{
desc => 'User goes to questionnaire URL for an already answered questionnaire',
answered => \'current_timestamp',
content => 'already answered this questionnaire',
+ code => 400,
},
) {
subtest $test->{desc} => sub {
@@ -106,7 +109,8 @@ foreach my $test (
$questionnaire->update;
(my $token = $token->token);
$token .= $test->{token_extra} if $test->{token_extra};
- $mech->get_ok("/Q/$token");
+ $mech->get("/Q/$token");
+ is $mech->res->code, $test->{code}, "Right status received";
$mech->content_contains( $test->{content} );
# Reset, no matter what test did
$report->state( 'confirmed' );
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index 4697cc9d1..1f11829b7 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -57,7 +57,7 @@ FixMyStreet::override_config {
};
subtest "test basic inspect submission" => sub {
- $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Yes', state => 'Planned' } });
+ $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Yes', state => 'Planned', save_inspected => undef } });
$report->discard_changes;
is $report->state, 'planned', 'report state changed';
is $report->get_extra_metadata('traffic_information'), 'Yes', 'report data changed';
@@ -201,7 +201,7 @@ FixMyStreet::override_config {
# which should cause it to be resent. We clear the host because
# otherwise testing stays on host() above.
$mech->clear_host;
- $mech->submit_form(button => 'save', with_fields => { category => 'Horses' });
+ $mech->submit_form(button => 'save', with_fields => { category => 'Horses', save_inspected => undef, });
$report->discard_changes;
is $report->category, "Horses", "Report in correct category";
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t
index 5a88097fa..f7544f0a1 100644
--- a/t/app/controller/report_updates.t
+++ b/t/app/controller/report_updates.t
@@ -1829,7 +1829,8 @@ for my $test (
subtest 'check have to be logged in for creator fixed questionnaire' => sub {
$mech->log_out_ok();
- $mech->get_ok( "/questionnaire/submit?problem=$report_id&reported=Yes" );
+ $mech->get( "/questionnaire/submit?problem=$report_id&reported=Yes" );
+ is $mech->res->code, 400, "got 400";
$mech->content_contains( "I'm afraid we couldn't locate your problem in the database." )
};
@@ -1838,7 +1839,8 @@ subtest 'check cannot answer other user\'s creator fixed questionnaire' => sub {
$mech->log_out_ok();
$mech->log_in_ok( $user2->email );
- $mech->get_ok( "/questionnaire/submit?problem=$report_id&reported=Yes" );
+ $mech->get( "/questionnaire/submit?problem=$report_id&reported=Yes" );
+ is $mech->res->code, 400, "got 400";
$mech->content_contains( "I'm afraid we couldn't locate your problem in the database." )
};