diff options
Diffstat (limited to 't/app/controller/admin.t')
-rw-r--r-- | t/app/controller/admin.t | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 3633286ff..a48e2e919 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -94,7 +94,11 @@ subtest 'check summary counts' => sub { my $alerts = FixMyStreet::App->model('DB::Alert')->search( { confirmed => { '>' => 0 } } ); my $a_count = $alerts->count; - $mech->get_ok('/admin'); + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'fixmystreet' ], + }, sub { + $mech->get_ok('/admin'); + }; $mech->title_like(qr/Summary/); @@ -106,10 +110,9 @@ subtest 'check summary counts' => sub { $mech->content_contains( "$q_count questionnaires sent" ); - SKIP: { - skip( "Need 'barnet' in ALLOWED_COBRANDS config", 7 ) - unless FixMyStreet::Cobrand->exists('barnet'); - + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'barnet' ], + }, sub { ok $mech->host('barnet.fixmystreet.com'); $mech->get_ok('/admin'); @@ -138,19 +141,23 @@ subtest 'check summary counts' => sub { $alert->cobrand(''); $alert->update; - } + }; FixMyStreet::App->model('DB::Problem')->search( { bodies_str => 1 } )->update( { bodies_str => 2489 } ); ok $mech->host('fixmystreet.com'); }; -my $host = FixMyStreet->config('BASE_URL'); - my $body = $mech->create_body_ok(2650, 'Aberdeen City Council'); -$mech->get_ok('/admin/body/2650'); +FixMyStreet::override_config { + MAPIT_URL => 'http://mapit.mysociety.org/', + MAPIT_TYPES => [ 'UTA' ], + BASE_URL => 'http://www.example.org', +}, sub { + $mech->get_ok('/admin/body/2650'); +}; $mech->content_contains('Aberdeen City Council'); $mech->content_like(qr{AB\d\d}); -$mech->content_contains("$host/around"); +$mech->content_contains("http://www.example.org/around"); subtest 'check contact creation' => sub { my $contact = FixMyStreet::App->model('DB::Contact')->search( @@ -556,7 +563,7 @@ foreach my $test ( $report->discard_changes; if ( $report->state eq 'confirmed' ) { - $mech->content_contains( 'type="submit" name="resend"', 'no resend button' ); + $mech->content_contains( 'type="submit" name="resend"', 'resend button' ); } else { $mech->content_lacks( 'type="submit" name="resend"', 'no resend button' ); } @@ -1212,6 +1219,15 @@ for my $test ( }; } +subtest "Test setting a report from unconfirmed to something else doesn't cause a front end error" => sub { + $report->update( { confirmed => undef, state => 'unconfirmed', non_public => 0 } ); + $mech->get_ok("/admin/report_edit/$report_id"); + $mech->submit_form_ok( { with_fields => { state => 'investigating' } } ); + $report->discard_changes; + ok( $report->confirmed, 'report has a confirmed timestamp' ); + $mech->get_ok("/report/$report_id"); +}; + $mech->delete_user( $user ); $mech->delete_user( $user2 ); $mech->delete_user( $user3 ); |