diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-08 22:11:57 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-14 16:03:30 +0100 |
commit | 466c5cac0f000bfa80ab49c88ec6e03c388ac328 (patch) | |
tree | 90cfb113103a1c5b5d2831956c4ea622a4df8ba5 /t/open311 | |
parent | 22226c7893167ebdb86363587cd1635a9b717ece (diff) |
Add inactive state to categories.
A new 'state' column replaces confirmed and deleted, allowing
categories to be unconfirmed, confirmed, deleted or inactive.
Diffstat (limited to 't/open311')
-rw-r--r-- | t/open311/populate-service-list.t | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/t/open311/populate-service-list.t b/t/open311/populate-service-list.t index 3ebe8e535..04740a9e8 100644 --- a/t/open311/populate-service-list.t +++ b/t/open311/populate-service-list.t @@ -49,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', @@ -66,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'; }; @@ -78,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', @@ -96,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'; @@ -111,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', @@ -130,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'; @@ -145,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', @@ -160,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', @@ -179,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'; @@ -217,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', @@ -397,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', @@ -471,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', @@ -573,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', |