use strict; use warnings; use Test::More; use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; my $secret = FixMyStreet::App->model('DB::Secret')->search(); # don't explode if there's nothing in the secret table if ( $secret == 0 ) { diag "You need to put an entry in the secret table for the admin tests to run"; plan skip_all => 'No entry in secret table'; } $mech->get_ok('/admin'); $mech->title_like(qr/Summary/); $mech->get_ok('/admin/council_contacts/2650'); $mech->content_contains('Aberdeen City Council'); $mech->content_contains('AB15 8RN'); subtest 'check contact creation' => sub { my $contact = FixMyStreet::App->model('DB::Contact')->find( { area_id => 2650, category => 'test category' } ); $contact->delete if $contact; my $history = FixMyStreet::App->model('DB::ContactsHistory')->search( { area_id => 2650, category => 'test category' } ); $history->delete_all; $mech->get_ok('/admin/council_contacts/2650'); $mech->submit_form_ok( { with_fields => { category => 'test category', email => 'test@example.com', note => 'test note', } } ); $mech->content_contains( 'test category' ); $mech->content_contains( '