aboutsummaryrefslogtreecommitdiffstats
path: root/t/open311/populate-service-list.t
diff options
context:
space:
mode:
Diffstat (limited to 't/open311/populate-service-list.t')
-rw-r--r--t/open311/populate-service-list.t46
1 files changed, 15 insertions, 31 deletions
diff --git a/t/open311/populate-service-list.t b/t/open311/populate-service-list.t
index 606bcbc44..04740a9e8 100644
--- a/t/open311/populate-service-list.t
+++ b/t/open311/populate-service-list.t
@@ -1,9 +1,6 @@
#!/usr/bin/env perl
-use strict;
-use warnings;
-use Test::More;
-
+use FixMyStreet::Test;
use FixMyStreet::DB;
use_ok( 'Open311::PopulateServiceList' );
@@ -52,8 +49,7 @@ subtest 'check non open311 contacts marked as deleted' => sub {
body_id => 1,
email => 'contact@example.com',
category => 'An old category',
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => $0,
whenedited => \'current_timestamp',
note => 'test contact',
@@ -69,7 +65,7 @@ subtest 'check non open311 contacts marked as deleted' => sub {
my $contact_count = FixMyStreet::DB->resultset('Contact')->search( { body_id => 1 } )->count();
is $contact_count, 4, 'correct number of contacts';
- $contact_count = FixMyStreet::DB->resultset('Contact')->search( { body_id => 1, deleted => 1 } )->count();
+ $contact_count = FixMyStreet::DB->resultset('Contact')->search( { body_id => 1, state => 'deleted' } )->count();
is $contact_count, 1, 'correct number of deleted contacts';
};
@@ -81,8 +77,7 @@ subtest 'check email changed if matching category' => sub {
body_id => 1,
email => '009',
category => 'Cans left out 24x7',
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => $0,
whenedited => \'current_timestamp',
note => 'test contact',
@@ -99,8 +94,7 @@ subtest 'check email changed if matching category' => sub {
$contact->discard_changes;
is $contact->email, '001', 'email unchanged';
- is $contact->confirmed, 1, 'contact still confirmed';
- is $contact->deleted, 0, 'contact still not deleted';
+ is $contact->state, 'confirmed', 'contact still confirmed';
my $contact_count = FixMyStreet::DB->resultset('Contact')->search( { body_id => 1 } )->count();
is $contact_count, 3, 'correct number of contacts';
@@ -114,8 +108,7 @@ subtest 'check category name changed if updated' => sub {
body_id => 1,
email => '001',
category => 'Bins left out 24x7',
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => $0,
whenedited => \'current_timestamp',
note => 'test contact',
@@ -133,8 +126,7 @@ subtest 'check category name changed if updated' => sub {
$contact->discard_changes;
is $contact->email, '001', 'email unchanged';
is $contact->category, 'Cans left out 24x7', 'category changed';
- is $contact->confirmed, 1, 'contact still confirmed';
- is $contact->deleted, 0, 'contact still not deleted';
+ is $contact->state, 'confirmed', 'contact still confirmed';
my $contact_count = FixMyStreet::DB->resultset('Contact')->search( { body_id => 1 } )->count();
is $contact_count, 3, 'correct number of contacts';
@@ -148,8 +140,7 @@ subtest 'check conflicting contacts not changed' => sub {
body_id => 1,
email => 'existing@example.com',
category => 'Cans left out 24x7',
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => $0,
whenedited => \'current_timestamp',
note => 'test contact',
@@ -163,8 +154,7 @@ subtest 'check conflicting contacts not changed' => sub {
body_id => 1,
email => '001',
category => 'Bins left out 24x7',
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => $0,
whenedited => \'current_timestamp',
note => 'test contact',
@@ -182,14 +172,12 @@ subtest 'check conflicting contacts not changed' => sub {
$contact->discard_changes;
is $contact->email, 'existing@example.com', 'first contact email unchanged';
is $contact->category, 'Cans left out 24x7', 'first contact category unchanged';
- is $contact->confirmed, 1, 'first contact contact still confirmed';
- is $contact->deleted, 0, 'first contact contact still not deleted';
+ is $contact->state, 'confirmed', 'first contact still confirmed';
$contact2->discard_changes;
is $contact2->email, '001', 'second contact email unchanged';
is $contact2->category, 'Bins left out 24x7', 'second contact category unchanged';
- is $contact2->confirmed, 1, 'second contact contact still confirmed';
- is $contact2->deleted, 0, 'second contact contact still not deleted';
+ is $contact2->state, 'confirmed', 'second contact still confirmed';
my $contact_count = FixMyStreet::DB->resultset('Contact')->search( { body_id => 1 } )->count();
is $contact_count, 4, 'correct number of contacts';
@@ -220,8 +208,7 @@ subtest 'check meta data population' => sub {
body_id => 1,
email => '001',
category => 'Bins left out 24x7',
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => $0,
whenedited => \'current_timestamp',
note => 'test contact',
@@ -400,8 +387,7 @@ for my $test (
body_id => 1,
email => '100',
category => 'Cans left out 24x7',
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => $0,
whenedited => \'current_timestamp',
note => 'test contact',
@@ -474,8 +460,7 @@ subtest 'check attribute ordering' => sub {
body_id => 1,
email => '001',
category => 'Bins left out 24x7',
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => $0,
whenedited => \'current_timestamp',
note => 'test contact',
@@ -576,8 +561,7 @@ subtest 'check bromely skip code' => sub {
body_id => 1,
email => '001',
category => 'Bins left out 24x7',
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => $0,
whenedited => \'current_timestamp',
note => 'test contact',