diff options
author | Struan Donald <struan@exo.org.uk> | 2012-09-03 17:49:47 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-09-03 17:49:47 +0100 |
commit | 41e11f0968be098f47f82986f255e037087624bb (patch) | |
tree | cfdcce530fc1336791ccf9ed46704714b9ea43a6 /perllib/FixMyStreet | |
parent | 350d82c314aa46367d0aba2b18e5858c9c46a025 (diff) |
tests for non public reports on around page
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/TestMech.pm | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index dc08f0240..2a9c3ba7b 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -532,19 +532,22 @@ sub delete_problems_for_council { } sub create_problems_for_council { - my ( $mech, $count, $council, $title, $dt, $user ) = @_; + my ( $mech, $count, $council, $title, $params ) = @_; - $dt = DateTime->now() unless $dt; + my $dt = DateTime->now() || $params->{dt}; - my @problems; - - $user = + my $user = FixMyStreet::App->model('DB::User') ->find_or_create( { email => 'test@example.com', name => 'Test User' } ) - unless $user;; + or $params->{user}; + + delete $params->{user}; + delete $params->{dt}; - while ( $count ) { - my $problem = FixMyStreet::App->model('DB::Problem')->create( { + my @problems; + + while ($count) { + my $default_params = { postcode => 'SW1A 1AA', council => $council, areas => ',105255,11806,11828,2247,2504,', @@ -565,7 +568,12 @@ sub create_problems_for_council { longitude => '-0.142497580865087', user_id => $user->id, photo => 1, - } ); + }; + + my %report_params = ( %$default_params, %$params ); + + my $problem = + FixMyStreet::App->model('DB::Problem')->create( \%report_params ); push @problems, $problem; $count--; |