diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2014-03-24 11:59:40 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2014-04-07 17:49:58 +0100 |
commit | b0170c4be0c2c3befcbe0159d4e218db5e0e37a8 (patch) | |
tree | 8f10f2a215fe1a6e7548e20ed535ce06339279a7 /t/app | |
parent | 8f8d5e017e34a0b68a4b9c5c6958c827dcb6a172 (diff) |
Update old-style open311 script to use bodies.
Add some comments to the top of the open311 bin scripts.
Diffstat (limited to 't/app')
-rw-r--r-- | t/app/controller/report_new.t | 4 | ||||
-rw-r--r-- | t/app/model/problem.t | 36 |
2 files changed, 17 insertions, 23 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index 2993eddac..84258f338 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -1453,6 +1453,10 @@ subtest "test SeeSomething" => sub { is $mech->uri->path, '/report/new', 'stays on report/new page'; $mech->content_contains( 'Your report has been sent', 'use report created template' ); } + + $user->alerts->delete; + $user->problems->delete; + $user->delete; }; } diff --git a/t/app/model/problem.t b/t/app/model/problem.t index fa8cf89ae..24ed959af 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -168,6 +168,10 @@ $problem->insert; my $tz_local = DateTime::TimeZone->new( name => 'local' ); +my $body = FixMyStreet::App->model('DB::Body')->new({ + name => 'Edinburgh City Council' +}); + for my $test ( { desc => 'request older than problem ignored', @@ -175,9 +179,6 @@ for my $test ( request => { updated_datetime => DateTime::Format::W3CDTF->new()->format_datetime( DateTime->now()->set_time_zone( $tz_local )->subtract( days => 2 ) ), }, - council => { - name => 'Edinburgh City Council', - }, created => 0, }, { @@ -188,9 +189,6 @@ for my $test ( status => 'open', status_notes => 'this is an update from the council', }, - council => { - name => 'Edinburgh City Council', - }, created => 1, state => 'confirmed', mark_fixed => 0, @@ -204,9 +202,6 @@ for my $test ( status => 'closed', status_notes => 'the council have fixed this', }, - council => { - name => 'Edinburgh City Council', - }, created => 1, state => 'fixed', mark_fixed => 1, @@ -220,9 +215,6 @@ for my $test ( status => 'open', status_notes => 'the council do not think this is fixed', }, - council => { - name => 'Edinburgh City Council', - }, created => 1, start_state => 'fixed', state => 'fixed', @@ -239,7 +231,7 @@ for my $test ( $problem->update; my $w3c = DateTime::Format::W3CDTF->new(); - my $ret = $problem->update_from_open311_service_request( $test->{request}, $test->{council}, $user ); + my $ret = $problem->update_from_open311_service_request( $test->{request}, $body, $user ); is $ret, $test->{created}, 'return value'; return unless $test->{created}; @@ -399,9 +391,6 @@ for my $body ( } # Let's make some contacts to send things to! -FixMyStreet::App->model('DB::Contact')->search( { - email => { 'like', '%example.com' }, -} )->delete; my @contacts; for my $contact ( { body_id => 2651, # Edinburgh @@ -760,13 +749,14 @@ subtest 'check reports from abuser not sent' => sub { ok $abuse->delete(), 'user removed from abuse table'; }; +END { + $problem->comments->delete if $problem; + $problem->delete if $problem; + $mech->delete_user( $user ) if $user; -$problem->comments->delete; -$problem->delete; -$mech->delete_user( $user ); + foreach (@contacts) { + $_->delete; + } -foreach (@contacts) { - $_->delete; + done_testing(); } - -done_testing(); |