aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2019-01-16 11:10:04 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2019-01-16 11:10:04 +0000
commitc94e0c9baddcb49b9e194d1c5f128b0f04b4e9ac (patch)
tree4a730b884cf4fd683b4b9c0a9410384c1aa84c2f /t
parent7ee6a869233e90c54ecce1863389bb5e5cb65b36 (diff)
parentbe0944d54e06e77a34f9149ccb63817d5ac7d184 (diff)
Merge branch 'allow-state-moderation'
Diffstat (limited to 't')
-rw-r--r--t/app/controller/moderate.t24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/app/controller/moderate.t b/t/app/controller/moderate.t
index 36a4bfbbd..438a81b25 100644
--- a/t/app/controller/moderate.t
+++ b/t/app/controller/moderate.t
@@ -277,6 +277,30 @@ subtest 'Problem moderation' => sub {
is $report->category, 'Lost toys';
};
+ subtest 'Moderate state' => sub {
+ my $mods_count = $report->moderation_original_datas->count;
+ my ($csrf) = $mech->content =~ /meta content="([^"]*)" name="csrf-token"/;
+ $mech->post_ok('http://www.example.org/moderate/report/' . $report->id, {
+ %problem_prepopulated,
+ state => 'confirmed',
+ token => $csrf,
+ });
+ $report->discard_changes;
+ is $report->state, 'confirmed', 'state has not changed';
+ is $report->comments->count, 0, 'same state, no update';
+ is $report->moderation_original_datas->count, $mods_count, 'No moderation entry either';
+ $mech->post_ok('http://www.example.org/moderate/report/' . $report->id, {
+ %problem_prepopulated,
+ state => 'in progress',
+ token => $csrf,
+ });
+ $report->discard_changes;
+ is $report->state, 'in progress', 'state has changed';
+ is $report->comments->count, 1, 'a new update added';
+ $report->update({ state => 'confirmed' });
+ is $report->moderation_original_datas->count, $mods_count, 'No moderation entry, only state changed';
+ };
+
subtest 'Moderate location' => sub {
FixMyStreet::override_config {
MAPIT_URL => 'http://mapit.uk/',