aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-01-08 16:16:18 +0000
committerMatthew Somerville <matthew@mysociety.org>2020-01-09 17:31:45 +0000
commit73a6134c4bb8c29e2755cf7241524dc0538a4a6a (patch)
treeb1b8cc7188a46ebc8b54b5fb510f04511c865135 /t
parenta47cdf03631855fd83866b932161eaa8ccf0c8b5 (diff)
[Inactive] Add option to only act on one cobrand.
Diffstat (limited to 't')
-rw-r--r--t/script/inactive.t25
1 files changed, 22 insertions, 3 deletions
diff --git a/t/script/inactive.t b/t/script/inactive.t
index 582059cbf..26eab33e1 100644
--- a/t/script/inactive.t
+++ b/t/script/inactive.t
@@ -23,6 +23,7 @@ for (my $m = 1; $m <= 12; $m++) {
dt => $t,
lastupdate => "$t",
state => $m % 2 ? 'fixed - user' : 'confirmed',
+ cobrand => $m % 3 ? 'default' : 'bromley',
});
}
@@ -51,12 +52,30 @@ subtest 'Anonymization of inactive fixed/closed reports' => sub {
is $comment->user->email, 'removed-automatically@example.org', 'Comment user anonymized';
};
+subtest 'Test operating on one cobrand only' => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => 'bromley'
+ }, sub {
+ my $in = FixMyStreet::Script::Inactive->new( cobrand => 'bromley', close => 1 );
+ $in->reports;
+ # Reports not a multiple of 2 are fixed, reports a multiple of 3 are bromley
+ $problems[2]->discard_changes;
+ is $problems[2]->get_extra_metadata('closed_updates'), 1, 'Closed to updates';
+ $problems[4]->discard_changes;
+ is $problems[4]->get_extra_metadata('closed_updates'), undef, 'Not closed to updates';
+ $problems[6]->discard_changes;
+ is $problems[6]->get_extra_metadata('closed_updates'), undef, 'Not closed to updates';
+ $problems[8]->discard_changes;
+ is $problems[8]->get_extra_metadata('closed_updates'), 1, 'Closed to updates';
+ };
+};
+
subtest 'Closing updates on inactive fixed/closed reports' => sub {
my $in = FixMyStreet::Script::Inactive->new( close => 1 );
$in->reports;
- $problems[2]->discard_changes;
- is $problems[2]->get_extra_metadata('closed_updates'), 1, 'Closed to updates';
- $mech->get_ok("/report/" . $problems[2]->id);
+ $problems[4]->discard_changes;
+ is $problems[4]->get_extra_metadata('closed_updates'), 1, 'Closed to updates';
+ $mech->get_ok("/report/" . $problems[4]->id);
$mech->content_contains('now closed to updates');
};