diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-03-13 18:04:55 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-03-13 21:54:29 +0000 |
commit | 76e533bd318cb4208faa1bf5cd0c00bde9e08e6c (patch) | |
tree | 7ada0b46c3e75b4d3977ca27960638c191354cc7 /t/cobrand | |
parent | e22563a5c8fde74a8a6f1de29948eb45487e9597 (diff) |
Factor out test contact creation to function.
Diffstat (limited to 't/cobrand')
-rw-r--r-- | t/cobrand/fixamingata.t | 9 | ||||
-rw-r--r-- | t/cobrand/fixmybarangay.t | 20 | ||||
-rw-r--r-- | t/cobrand/zurich.t | 9 |
3 files changed, 8 insertions, 30 deletions
diff --git a/t/cobrand/fixamingata.t b/t/cobrand/fixamingata.t index 714d475e1..3c818474d 100644 --- a/t/cobrand/fixamingata.t +++ b/t/cobrand/fixamingata.t @@ -25,16 +25,11 @@ FixMyStreet::override_config { $mech->content_like( qr/FixaMinGata/ ); my $body = $mech->create_body_ok( 1, 'Body' ); -FixMyStreet::App->model('DB::Contact')->find_or_create({ +$mech->create_contact_ok( body => $body, category => "Other", email => "other\@example.org", - confirmed => 1, - deleted => 0, - editor => "Editor", - whenedited => \'now()', - note => 'Note', -}); +); my @reports = $mech->create_problems_for_body( 1, $body->id, 'Test', { cobrand => 'fixamingata', diff --git a/t/cobrand/fixmybarangay.t b/t/cobrand/fixmybarangay.t index edb14fe3d..316739dfa 100644 --- a/t/cobrand/fixmybarangay.t +++ b/t/cobrand/fixmybarangay.t @@ -37,28 +37,16 @@ FixMyStreet::App->model('DB::BodyArea')->find_or_create({ area_id => 2, body_id # TODO: log in as a Bgy user, and create a report using the front end, # testing that the drop-down has the right things in it, and so on. -my %contact_params = ( - confirmed => 1, - deleted => 0, - editor => 'Test', - whenedited => \'current_timestamp', - note => 'Created for test', -); -FixMyStreet::App->model('DB::Contact')->search( { - email => { 'like', '%example.com' }, -} )->delete; -my $contact1 = FixMyStreet::App->model('DB::Contact')->find_or_create( { - %contact_params, +$mech->create_contact_ok( body_id => $luz->id, category => 'Streetlight (BGY)', email => 'bgy@example.com', -} ); -my $contact2 = FixMyStreet::App->model('DB::Contact')->find_or_create( { - %contact_params, +); +$mech->create_contact_ok( body_id => $dps->id, category => 'Streetlight (DPS)', email => 'LIGHT', -} ); +); # Create a couple of reports diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t index 8dbc43464..203bbc0f8 100644 --- a/t/cobrand/zurich.t +++ b/t/cobrand/zurich.t @@ -137,16 +137,11 @@ $mech->content_contains( 'Erfasst' ); subtest "changing of categories" => sub { # create a few categories (which are actually contacts) foreach my $name ( qw/Cat1 Cat2/ ) { - FixMyStreet::App->model('DB::Contact')->find_or_create({ + $mech->create_contact_ok( body => $division, category => $name, email => "$name\@example.org", - confirmed => 1, - deleted => 0, - editor => "editor", - whenedited => DateTime->now(), - note => "note for $name", - }); + ); } # put report into known category |