aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2015-10-27 13:27:03 +0100
committerMarius Halden <marius.h@lden.org>2015-10-27 13:27:03 +0100
commit4fb5331abd2fa4c89ebeb89bc92a245fadd0aa19 (patch)
tree23632b448612e3845a6e8b1aed6490151395de2a /t/app/controller
parente609613b5041a15491417eaa9ae129dd1e7531dd (diff)
parentac39951581a0eefe069c8a707bb89977227d0bce (diff)
Merge tag 'v1.7' into fiksgatami-dev
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/admin.t2
-rw-r--r--t/app/controller/alert_new.t12
-rw-r--r--t/app/controller/around.t10
-rw-r--r--t/app/controller/contact.t2
-rw-r--r--t/app/controller/moderate.t10
-rw-r--r--t/app/controller/photo.t75
-rw-r--r--t/app/controller/questionnaire.t16
-rw-r--r--t/app/controller/report_display.t142
-rw-r--r--t/app/controller/report_import.t37
-rw-r--r--t/app/controller/report_new.t11
-rw-r--r--t/app/controller/report_updates.t8
-rw-r--r--t/app/controller/reports.t23
-rw-r--r--t/app/controller/rss.t7
13 files changed, 251 insertions, 104 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 498f1cedc..e2dd5df19 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -88,7 +88,7 @@ subtest 'check summary counts' => sub {
FixMyStreet::App->model('DB::Problem')->search( { bodies_str => 2489 } )->update( { bodies_str => 1 } );
my $q = FixMyStreet::App->model('DB::Questionnaire')->find_or_new( { problem => $report, });
- $q->whensent( \'ms_current_timestamp()' );
+ $q->whensent( \'current_timestamp' );
$q->in_storage ? $q->update : $q->insert;
my $alerts = FixMyStreet::App->model('DB::Alert')->search( { confirmed => { '>' => 0 } } );
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t
index ac2ec20ac..777d733e2 100644
--- a/t/app/controller/alert_new.t
+++ b/t/app/controller/alert_new.t
@@ -11,7 +11,7 @@ foreach my $test (
{
email => 'test@example.com',
type => 'area_problems',
- content => 'your alert will not be activated',
+ content => 'Click the link in our confirmation email to activate your alert',
email_text => "confirms that you'd like to receive an email",
uri =>
'/alert/subscribe?type=local&rznvy=test@example.com&feed=area:1000:A_Location',
@@ -20,7 +20,7 @@ foreach my $test (
{
email => 'test@example.com',
type => 'council_problems',
- content => 'your alert will not be activated',
+ content => 'Click the link in our confirmation email to activate your alert',
email_text => "confirms that you'd like to receive an email",
uri =>
'/alert/subscribe?type=local&rznvy=test@example.com&feed=council:1000:A_Location',
@@ -30,7 +30,7 @@ foreach my $test (
{
email => 'test@example.com',
type => 'ward_problems',
- content => 'your alert will not be activated',
+ content => 'Click the link in our confirmation email to activate your alert',
email_text => "confirms that you'd like to receive an email",
uri =>
'/alert/subscribe?type=local&rznvy=test@example.com&feed=ward:1000:1001:A_Location:Diff_Location',
@@ -40,7 +40,7 @@ foreach my $test (
{
email => 'test@example.com',
type => 'local_problems',
- content => 'your alert will not be activated',
+ content => 'Click the link in our confirmation email to activate your alert',
email_text => "confirms that you'd like to receive an email",
uri =>
'/alert/subscribe?type=local&rznvy=test@example.com&feed=local:10.2:20.1',
@@ -50,7 +50,7 @@ foreach my $test (
{
email => 'test@example.com',
type => 'new_updates',
- content => 'your alert will not be activated',
+ content => 'Click the link in our confirmation email to activate your alert',
email_text => "confirms that you'd like to receive an email",
uri => '/alert/subscribe?type=updates&rznvy=test@example.com&id=1',
param1 => 1,
@@ -236,7 +236,7 @@ for my $test (
{
email => 'test@example.com',
type => 'new_updates',
- content => 'your alert will not be activated',
+ content => 'Click the link in our confirmation email to activate your alert',
email_text => 'confirm the alert',
uri => '/alert/subscribe?type=updates&rznvy=test@example.com&id=1',
param1 => 1,
diff --git a/t/app/controller/around.t b/t/app/controller/around.t
index 03bcebf96..a70116525 100644
--- a/t/app/controller/around.t
+++ b/t/app/controller/around.t
@@ -1,7 +1,9 @@
use strict;
use warnings;
use Test::More;
+use LWP::Protocol::PSGI;
+use t::MapIt;
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
@@ -71,8 +73,8 @@ foreach my $test (
foreach my $test (
{
pc => 'SW1A 1AA',
- latitude => '51.501009',
- longitude => '-0.141588',
+ latitude => '51.5',
+ longitude => '-2.1',
},
{
pc => 'TQ 388 773',
@@ -82,10 +84,12 @@ foreach my $test (
)
{
subtest "check lat/lng for '$test->{pc}'" => sub {
+ LWP::Protocol::PSGI->register(t::MapIt->run_if_script, host => 'mapit.uk');
+
$mech->get_ok('/');
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
- MAPIT_URL => 'http://mapit.mysociety.org/',
+ MAPIT_URL => 'http://mapit.uk/',
}, sub {
$mech->submit_form_ok( { with_fields => { pc => $test->{pc} } },
"good location" );
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t
index cf8a3161b..4ac69a9f8 100644
--- a/t/app/controller/contact.t
+++ b/t/app/controller/contact.t
@@ -93,7 +93,7 @@ for my $test (
user => $update_user,
state => 'confirmed',
text => $update_info->{text},
- confirmed => \'ms_current_timestamp()',
+ confirmed => \'current_timestamp',
mark_fixed => 'f',
anonymous => 'f',
}
diff --git a/t/app/controller/moderate.t b/t/app/controller/moderate.t
index cd4c742bb..b79f50e73 100644
--- a/t/app/controller/moderate.t
+++ b/t/app/controller/moderate.t
@@ -42,10 +42,7 @@ sub create_report {
latitude => '51.4129',
longitude => '0.007831',
user_id => $user->id,
- photo => 'DUMMY DATA', # this obv fake data would not be
- # accepted by front-end but is
- # enough to trigger "I have a
- # photo" behaviour
+ photo => $mech->get_photo_data,
});
}
my $report = create_report();
@@ -216,7 +213,7 @@ sub create_update {
user => $user,
name => 'Test User',
anonymous => 'f',
- photo => 'DUMMY DATA', # as above
+ photo => $mech->get_photo_data,
text => 'update good good bad good',
state => 'confirmed',
mark_fixed => 0,
@@ -283,7 +280,8 @@ subtest 'updates' => sub {
$mech->get_ok($REPORT_URL);
- $mech->content_contains('Photo of this report');
+ $mech->content_contains('Photo of this report')
+ or die $mech->content;
$mech->post_ok( $MODERATE_UPDATE_URL, {
%update_prepopulated,
diff --git a/t/app/controller/photo.t b/t/app/controller/photo.t
new file mode 100644
index 000000000..6e61ebb32
--- /dev/null
+++ b/t/app/controller/photo.t
@@ -0,0 +1,75 @@
+use strict;
+use utf8; # sign in error message has &ndash; in it
+use warnings;
+use feature 'say';
+use Test::More;
+use utf8;
+
+use FixMyStreet::TestMech;
+use FixMyStreet::App;
+use Web::Scraper;
+use Path::Tiny;
+use File::Temp 'tempdir';
+
+# disable info logs for this test run
+FixMyStreet::App->log->disable('info');
+END { FixMyStreet::App->log->enable('info'); }
+
+my $mech = FixMyStreet::TestMech->new;
+
+my $sample_file = path(__FILE__)->parent->child("sample.jpg");
+ok $sample_file->exists, "sample file $sample_file exists";
+
+my $westminster = $mech->create_body_ok(2527, 'Liverpool City Council');
+
+subtest "Check multiple upload worked" => sub {
+ $mech->get_ok('/around');
+
+ my $UPLOAD_DIR = tempdir( CLEANUP => 1 );
+
+ # submit initial pc form
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ UPLOAD_DIR => $UPLOAD_DIR,
+ }, sub {
+
+ $mech->log_in_ok('test@example.com');
+
+
+ # submit the main form
+ # can't post_ok as we lose the Content_Type header
+ # (TODO rewrite with HTTP::Request::Common and request_ok)
+ $mech->post( '/report/new',
+ Content_Type => 'form-data',
+ Content =>
+ {
+ submit_problem => 1,
+ title => 'Test',
+ lat => 53.4031156, lon => -2.9840579, # in Liverpool
+ pc => 'L1 4LN',
+ detail => 'Detail',
+ photo1 => [ $sample_file, undef, Content_Type => 'application/octet-stream' ],
+ photo2 => [ $sample_file, undef, Content_Type => 'application/octet-stream' ],
+ photo3 => [ $sample_file, undef, Content_Type => 'application/octet-stream' ],
+ name => 'Bob Jones',
+ may_show_name => '1',
+ email => 'test@example.com',
+ phone => '',
+ category => 'Street lighting',
+ #password_sign_in => '',
+ #password_register => '',
+ #remember_me => undef,
+ }
+ );
+ ok $mech->success, 'Made request with multiple photo upload';
+ $mech->base_is('http://localhost/report/new');
+ $mech->content_contains(
+ 'name="upload_fileid" value="1cdd4329ceee2234bd4e89cb33b42061a0724687,1cdd4329ceee2234bd4e89cb33b42061a0724687,1cdd4329ceee2234bd4e89cb33b42061a0724687"',
+ 'Returned upload_fileid contains expected hash, 3 times');
+ my $image_file = path($UPLOAD_DIR, '1cdd4329ceee2234bd4e89cb33b42061a0724687.jpeg');
+ ok $image_file->exists, 'File uploaded to temp';
+ };
+};
+
+done_testing();
diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t
index 5938acc79..2a89454d5 100644
--- a/t/app/controller/questionnaire.t
+++ b/t/app/controller/questionnaire.t
@@ -96,7 +96,7 @@ foreach my $test (
},
{
desc => 'User goes to questionnaire URL for an already answered questionnaire',
- answered => \'ms_current_timestamp()',
+ answered => \'current_timestamp',
content => 'already answered this questionnaire',
},
) {
@@ -191,6 +191,16 @@ foreach my $test (
},
},
{
+ desc => 'Fixed report, reopened, reported before, blank update, no further questionnaire',
+ problem_state => 'fixed',
+ fields => {
+ been_fixed => 'No',
+ reported => 'Yes',
+ another => 'No',
+ update => ' ',
+ },
+ },
+ {
desc => 'Closed report, said fixed, reported before, no update, no further questionnaire',
problem_state => 'closed',
fields => {
@@ -266,7 +276,7 @@ foreach my $test (
$questionnaire->discard_changes;
is $report->state, $result eq 'unknown' ? $test->{problem_state} : $result;
is $report->send_questionnaire, $another;
- ok DateTime::Format::Pg->format_datetime( $report->lastupdate) gt $report_time, 'lastupdate changed'
+ ok (DateTime::Format::Pg->format_datetime( $report->lastupdate) gt $report_time, 'lastupdate changed')
unless $test->{fields}{been_fixed} eq 'Unknown' || $test->{lastupdate_static};
is $questionnaire->old_state, $test->{problem_state};
is $questionnaire->new_state, $result;
@@ -315,7 +325,7 @@ my $comment = FixMyStreet::App->model('DB::Comment')->find_or_create(
);
subtest 'Check updates are shown correctly on questionnaire page' => sub {
$mech->get_ok("/Q/" . $token->token);
- $mech->content_contains( 'updates that have been left' );
+ $mech->content_contains( 'Show all updates' );
$mech->content_contains( 'This is some update text' );
};
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t
index 002cdc1e5..265760d86 100644
--- a/t/app/controller/report_display.t
+++ b/t/app/controller/report_display.t
@@ -96,19 +96,6 @@ subtest "change report to unconfirmed and check for 404 status" => sub {
};
-subtest "Zurich unconfirmeds are 200" => sub {
- FixMyStreet::override_config {
- ALLOWED_COBRANDS => [ 'zurich' ],
- }, sub {
- $mech->host( 'zurich.example.com' );
- ok $report->update( { state => 'unconfirmed' } ), 'unconfirm report';
- $mech->get_ok("/report/$report_id");
- $mech->content_contains( '&Uuml;berpr&uuml;fung ausstehend' );
- ok $report->update( { state => 'confirmed' } ), 'confirm report again';
- $mech->host( 'www.fixmystreet.com' );
- };
-};
-
subtest "change report to hidden and check for 410 status" => sub {
ok $report->update( { state => 'hidden' } ), 'hide report';
ok $mech->get("/report/$report_id"), "get '/report/$report_id'";
@@ -400,9 +387,72 @@ for my $test (
};
}
+my $body_westminster = $mech->create_body_ok(2504, 'Westminster City Council');
+my $body_camden = $mech->create_body_ok(2505, 'Camden Borough Council');
+
+for my $test (
+ {
+ desc => 'no state dropdown if user not from authority',
+ from_body => undef,
+ no_state => 1,
+ report_body => $body_westminster->id,
+ },
+ {
+ desc => 'state dropdown if user from authority',
+ from_body => $body_westminster->id,
+ no_state => 0,
+ report_body => $body_westminster->id,
+ },
+ {
+ desc => 'no state dropdown if user not from same body as problem',
+ from_body => $body_camden->id,
+ no_state => 1,
+ report_body => $body_westminster->id,
+ },
+ {
+ desc => 'state dropdown if user from authority and problem sent to multiple bodies',
+ from_body => $body_westminster->id,
+ no_state => 0,
+ report_body => $body_westminster->id . ',2506',
+ },
+) {
+ subtest $test->{desc} => sub {
+ $mech->log_in_ok( $user->email );
+ $user->from_body( $test->{from_body} );
+ $user->update;
+
+ $report->discard_changes;
+ $report->bodies_str( $test->{report_body} );
+ $report->update;
+
+ $mech->get_ok("/report/$report_id");
+ my $fields = $mech->visible_form_values( 'updateForm' );
+ if ( $test->{no_state} ) {
+ ok !$fields->{state};
+ } else {
+ ok $fields->{state};
+ }
+ };
+}
+
+subtest "Zurich unconfirmeds are 200" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+ MAP_TYPE => 'Zurich,OSM',
+ }, sub {
+ $mech->host( 'zurich.example.com' );
+ ok $report->update( { state => 'unconfirmed' } ), 'unconfirm report';
+ $mech->get_ok("/report/$report_id");
+ $mech->content_contains( '&Uuml;berpr&uuml;fung ausstehend' );
+ ok $report->update( { state => 'confirmed' } ), 'confirm report again';
+ $mech->host( 'www.fixmystreet.com' );
+ };
+};
+
subtest "Zurich banners are displayed correctly" => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'zurich' ],
+ MAP_TYPE => 'Zurich,OSM',
}, sub {
$mech->host( 'zurich.example.com' );
@@ -428,8 +478,8 @@ subtest "Zurich banners are displayed correctly" => sub {
{
description => 'closed report',
state => 'closed',
- banner_id => 'fixed',
- banner_text => 'Beantwortet',
+ banner_id => 'closed',
+ banner_text => _('Extern'),
},
{
description => 'in progress report',
@@ -443,6 +493,21 @@ subtest "Zurich banners are displayed correctly" => sub {
banner_id => 'progress',
banner_text => 'In Bearbeitung',
},
+ {
+ description => 'planned report',
+ state => 'planned',
+ banner_id => 'progress',
+ banner_text => 'In Bearbeitung',
+ },
+ {
+ description => 'jurisdiction unknown',
+ state => 'unable to fix',
+ banner_id => 'fixed',
+ # We can't use _('Jurisdiction Unknown') here because
+ # TestMech::extract_problem_banner decodes the HTML entities before
+ # the string is passed back.
+ banner_text => 'Zust\x{e4}ndigkeit unbekannt',
+ },
) {
subtest "banner for $test->{description}" => sub {
$report->state( $test->{state} );
@@ -470,53 +535,6 @@ subtest "Zurich banners are displayed correctly" => sub {
};
};
-my $body_westminster = $mech->create_body_ok(2504, 'Westminster City Council');
-my $body_camden = $mech->create_body_ok(2505, 'Camden Borough Council');
-
-for my $test (
- {
- desc => 'no state dropdown if user not from authority',
- from_body => undef,
- no_state => 1,
- report_body => $body_westminster->id,
- },
- {
- desc => 'state dropdown if user from authority',
- from_body => $body_westminster->id,
- no_state => 0,
- report_body => $body_westminster->id,
- },
- {
- desc => 'no state dropdown if user not from same body as problem',
- from_body => $body_camden->id,
- no_state => 1,
- report_body => $body_westminster->id,
- },
- {
- desc => 'state dropdown if user from authority and problem sent to multiple bodies',
- from_body => $body_westminster->id,
- no_state => 0,
- report_body => $body_westminster->id . ',2506',
- },
-) {
- subtest $test->{desc} => sub {
- $mech->log_in_ok( $user->email );
- $user->from_body( $test->{from_body} );
- $user->update;
-
- $report->discard_changes;
- $report->bodies_str( $test->{report_body} );
- $report->update;
-
- $mech->get_ok("/report/$report_id");
- my $fields = $mech->visible_form_values( 'updateForm' );
- if ( $test->{no_state} ) {
- ok !$fields->{state};
- } else {
- ok $fields->{state};
- }
- };
-}
END {
$mech->delete_user('test@example.com');
diff --git a/t/app/controller/report_import.t b/t/app/controller/report_import.t
index ff6508149..4d0f6e5d1 100644
--- a/t/app/controller/report_import.t
+++ b/t/app/controller/report_import.t
@@ -1,7 +1,9 @@
use strict;
use warnings;
use Test::More;
+use LWP::Protocol::PSGI;
+use t::MapIt;
use FixMyStreet::TestMech;
use FixMyStreet::App;
use Web::Scraper;
@@ -17,7 +19,7 @@ ok -e $sample_file, "sample file $sample_file exists";
FixMyStreet::App->log->disable('info');
END { FixMyStreet::App->log->enable('info'); }
-my $body = $mech->create_body_ok(2504, 'Westminster City Council');
+my $body = $mech->create_body_ok(2245, 'Wiltshire Council');
$mech->create_contact_ok(
body_id => $body->id,
category => 'Street lighting',
@@ -90,6 +92,7 @@ subtest "Test creating bad partial entries" => sub {
};
subtest "Submit a correct entry" => sub {
+ LWP::Protocol::PSGI->register(t::MapIt->run_if_script, host => 'mapit.uk');
$mech->get_ok('/import');
@@ -120,7 +123,7 @@ subtest "Submit a correct entry" => sub {
# go to the token url
FixMyStreet::override_config {
- MAPIT_URL => 'http://mapit.mysociety.org/',
+ MAPIT_URL => 'http://mapit.uk/',
}, sub {
$mech->get_ok($token_url);
};
@@ -134,10 +137,10 @@ subtest "Submit a correct entry" => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'fixmystreet' ],
- MAPIT_URL => 'http://mapit.mysociety.org/',
+ MAPIT_URL => 'http://mapit.uk/',
}, sub {
$mech->submit_form_ok(
- { with_fields => { pc => 'SW1A 1AA' } },
+ { with_fields => { pc => 'SN15 5NG' } },
"fill in postcode"
);
};
@@ -159,15 +162,15 @@ subtest "Submit a correct entry" => sub {
# Check photo present, and still there after map submission (testing bug #18)
$mech->content_contains( '<img align="right" src="/photo/' );
- $mech->content_contains('latitude" value="51.501009"', 'Check latitude');
- $mech->content_contains('longitude" value="-0.141588"', 'Check longitude');
+ $mech->content_contains('latitude" value="51.5"', 'Check latitude');
+ $mech->content_contains('longitude" value="-2.1"', 'Check longitude');
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
- MAPIT_URL => 'http://mapit.mysociety.org/',
+ MAPIT_URL => 'http://mapit.uk/',
}, sub {
$mech->submit_form_ok(
{
- button => 'tile_32742.21793',
+ button => 'tile_16192.10896',
x => 10,
y => 10,
},
@@ -175,8 +178,8 @@ subtest "Submit a correct entry" => sub {
);
};
$mech->content_contains( '<img align="right" src="/photo/' );
- $mech->content_contains('latitude" value="51.50519"', 'Check latitude');
- $mech->content_contains('longitude" value="-0.142608"', 'Check longitude');
+ $mech->content_contains('latitude" value="51.508475"', 'Check latitude');
+ $mech->content_contains('longitude" value="-2.108946"', 'Check longitude');
# check that fields haven't changed at all
is_deeply $mech->visible_form_values,
@@ -194,7 +197,7 @@ subtest "Submit a correct entry" => sub {
# change the details
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
- MAPIT_URL => 'http://mapit.mysociety.org/',
+ MAPIT_URL => 'http://mapit.uk/',
}, sub {
$mech->submit_form_ok(
{
@@ -232,8 +235,8 @@ subtest "Submit a correct entry (with location)" => sub {
{
with_fields => {
service => 'test-script',
- lat => '51.5010096115539', # SW1A 1AA
- lon => '-0.141587067110009',
+ lat => '51.5',
+ lon => '-2.1',
name => 'Test User ll',
email => 'test-ll@example.com',
subject => 'Test report ll',
@@ -318,6 +321,7 @@ subtest "Submit a correct entry (with location) to cobrand" => sub {
MAPIT_URL => 'http://global.mapit.mysociety.org/',
MAPIT_TYPES => [ 'O08' ],
MAPIT_ID_WHITELIST => [],
+ MAP_TYPE => 'Zurich,OSM',
}, sub {
ok $mech->host("zurich.example.org"), 'change host to zurich';
@@ -361,11 +365,14 @@ subtest "Submit a correct entry (with location) to cobrand" => sub {
{
name => 'Test User ll',
detail => 'This is a test report ll',
- photo => '',
+ photo1 => '',
+ photo2 => '',
+ photo3 => '',
phone => '',
email => 'test-ll@example.com',
},
- "check imported fields are shown";
+ "check imported fields are shown"
+ or diag Dumper( $mech->visible_form_values ); use Data::Dumper;
my $user =
FixMyStreet::App->model('DB::User')
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index bd0001be8..3c05adfbd 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -1475,7 +1475,7 @@ subtest "unresponsive body handling works" => sub {
ok $mech->content_like( qr{Edinburgh.*accept reports.*/unresponsive\?body=$body_id} );
my $test_email = 'test-2@example.com';
- my $user = $mech->log_in_ok($test_email);
+ $mech->log_out_ok;
$mech->get_ok('/around');
$mech->submit_form_ok( { with_fields => { pc => 'EH1 1BB', } }, "submit location" );
$mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" );
@@ -1486,6 +1486,7 @@ subtest "unresponsive body handling works" => sub {
detail => 'Test report details.',
photo => '',
name => 'Joe Bloggs',
+ email => $test_email,
may_show_name => '1',
phone => '07903 123 456',
category => 'Trees',
@@ -1494,10 +1495,17 @@ subtest "unresponsive body handling works" => sub {
"submit good details"
);
+ my $user = FixMyStreet::App->model('DB::User')->find( { email => $test_email } );
+ ok $user, "test user does exist";
+
my $report = $user->problems->first;
ok $report, "Found the report";
is $report->bodies_str, undef, "Report not going anywhere";
+ my $email = $mech->get_email;
+ ok $email, "got an email";
+ like $email->body, qr/despite not being sent/i, "correct email sent";
+
$user->problems->delete;
$contact1->body->update( { send_method => $old_send } );
@@ -1517,6 +1525,7 @@ subtest "unresponsive body handling works" => sub {
detail => 'Test report details.',
photo => '',
name => 'Joe Bloggs',
+ email => $test_email,
may_show_name => '1',
phone => '07903 123 456',
category => 'Trees',
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t
index fa6c44292..6c6b4ca19 100644
--- a/t/app/controller/report_updates.t
+++ b/t/app/controller/report_updates.t
@@ -353,7 +353,7 @@ for my $test (
'submit update'
);
- $mech->content_contains('Nearly Done! Now check your email');
+ $mech->content_contains('Nearly done! Now check your email');
my $email = $mech->get_email;
ok $email, "got an email";
@@ -1007,7 +1007,7 @@ subtest 'submit an update for a registered user, creating update by email' => su
},
}, 'submit update' );
- $mech->content_contains('Nearly Done! Now check your email');
+ $mech->content_contains('Nearly done! Now check your email');
# No change to user yet.
$user->discard_changes;
@@ -1339,7 +1339,7 @@ foreach my $test (
{
problem_id => $report_id,
ever_reported => 'y',
- whensent => \'ms_current_timestamp()',
+ whensent => \'current_timestamp',
}
);
@@ -1481,7 +1481,7 @@ for my $test (
{
problem_id => $report_id,
ever_reported => 'y',
- whensent => \'ms_current_timestamp()',
+ whensent => \'current_timestamp',
}
);
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t
index ecb43f447..02625fcc7 100644
--- a/t/app/controller/reports.t
+++ b/t/app/controller/reports.t
@@ -216,5 +216,28 @@ subtest "test fiksgatami all reports page" => sub {
}
};
+subtest "test greenwich all reports page" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'greenwich' ],
+ MAPIT_URL => 'http://mapit.mysociety.org/'
+ }, sub {
+ my $body = $mech->create_body_ok(2493, 'Royal Borough of Greenwich');
+ my $deleted_contact = $mech->create_contact_ok(
+ body_id => $body->id,
+ category => 'Deleted',
+ email => 'deleted@example.com',
+ deleted => 1
+ );
+ ok $mech->host("greenwich.fixmystreet.com"), 'change host to greenwich';
+ $mech->get_ok('/reports/Royal+Borough+of+Greenwich');
+ # There should not be deleted categories in the list
+ my $category_select = $mech->forms()->[0]->find_input('filter_category');
+ is $category_select->possible_values, 1, 'deleted categories are not shown';
+
+ # Clean up after the test
+ $deleted_contact->delete;
+ }
+};
+
done_testing();
diff --git a/t/app/controller/rss.t b/t/app/controller/rss.t
index ae1c0d193..db653c094 100644
--- a/t/app/controller/rss.t
+++ b/t/app/controller/rss.t
@@ -127,11 +127,14 @@ $mech->content_contains( '18 North Bridge, Edinburgh' );
$report->delete();
+my $council = $mech->create_body_ok(2333, 'Hart Council');
+my $county = $mech->create_body_ok(2227, 'Hampshire Council');
+
my $now = DateTime->now();
my $report_to_council = FixMyStreet::App->model('DB::Problem')->find_or_create(
{
postcode => 'GU51 4AE',
- bodies_str => '2333',
+ bodies_str => $council->id,
areas => ',2333,2227,',
category => 'Other',
title => 'council report',
@@ -155,7 +158,7 @@ my $report_to_council = FixMyStreet::App->model('DB::Problem')->find_or_create(
my $report_to_county_council = FixMyStreet::App->model('DB::Problem')->find_or_create(
{
postcode => 'GU51 4AE',
- bodies_str => '2227',
+ bodies_str => $county->id,
areas => ',2333,2227,',
category => 'Other',
title => 'county report',