diff options
-rw-r--r-- | notes/INSTALL-catalyst.txt | 1 | ||||
-rw-r--r-- | t/app/controller/report_display.t | 2 | ||||
-rw-r--r-- | t/app/controller/reports.t | 34 | ||||
-rwxr-xr-x | templates/web/emptyhomes/reports/index.html | 2 |
4 files changed, 37 insertions, 2 deletions
diff --git a/notes/INSTALL-catalyst.txt b/notes/INSTALL-catalyst.txt index 821b5a432..1c44bea80 100644 --- a/notes/INSTALL-catalyst.txt +++ b/notes/INSTALL-catalyst.txt @@ -105,3 +105,4 @@ or a specific test in verbose mode using: prove -lv t/app/controller/report_new.t For all the lovely options do 'prove --help'. Note I've made no attempt to make the tests be able to run in parallel, the database fiddling would not be worth it. +The tests currently assume MAPIT_URL is set to the UK version. diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t index 2afff21dd..7be9f387e 100644 --- a/t/app/controller/report_display.t +++ b/t/app/controller/report_display.t @@ -246,7 +246,7 @@ for my $test ( if ( $test->{fixed} ) { is $update_form->find_input( 'fixed' ), undef, 'problem is fixed'; } else { - ok $update_form->find_input( 'fixed' ) != undef, 'problem is not fixed'; + ok $update_form->find_input( 'fixed' ), 'problem is not fixed'; } }; } diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t new file mode 100644 index 000000000..312297436 --- /dev/null +++ b/t/app/controller/reports.t @@ -0,0 +1,34 @@ +use strict; +use warnings; +use Test::More; +use Test::WWW::Mechanize::Catalyst 'FixMyStreet::App'; +use mySociety::MaPit; + +ok( my $mech = Test::WWW::Mechanize::Catalyst->new, 'Created mech object' ); + +# check that we can get the page +$mech->get_ok('/reports'); +$mech->title_like(qr{Summary reports}); +$mech->content_contains('Birmingham'); +$mech->follow_link_ok( { text_regex => qr/Birmingham/ } ); + +SKIP: { + skip( "Need 'emptyhomes' in ALLOWED_COBRANDS config", 8 ) + unless FixMyStreet::App->config->{ALLOWED_COBRANDS} =~ m{emptyhomes}; + ok $mech->host("reportemptyhomes.com"), 'change host to reportemptyhomes'; + $mech->get_ok('/reports'); + # EHA lacks one column the others have + $mech->content_lacks('state unknown'); + + # FIXME To do the below, need a way of altering where MaPit is pointing + # skip( "Need 'fiksgatami' in ALLOWED_COBRANDS config", 8 ) + # unless FixMyStreet::App->config->{ALLOWED_COBRANDS} =~ m{fiksgatami}; + # ok $mech->host("fiksgatami.no"), 'change host to fiksgatami'; + # $mech->get_ok('/reports'); + # # There should only be one Oslo + # $mech->content_contains('Oslo'); + # $mech->content_unlike(qr{Oslo.*Oslo}s); +} + +done_testing(); + diff --git a/templates/web/emptyhomes/reports/index.html b/templates/web/emptyhomes/reports/index.html index 13805ab43..003954f19 100755 --- a/templates/web/emptyhomes/reports/index.html +++ b/templates/web/emptyhomes/reports/index.html @@ -22,7 +22,7 @@ > <td align="left"><a href="[% area.url %]">[% area.name %]</a></td> <td>[% open.${area.id}.new.size or 0 %]</td> -<td>[% open.${area.id}.older.list.size + open.${area.id}.unknown.list.size %]</td> +<td>[% (open.${area.id}.older.size or 0) + (open.${area.id}.unknown.size or 0) %]</td> <td>[% fixed.${area.id}.new.size or 0 %]</td> <td>[% fixed.${area.id}.old.size or 0 %]</td> </tr> |