aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/admin
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-06-17 15:01:35 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-06-17 15:01:35 +0100
commit38c61346ca940f837b49fba3bc0548dd21b7ee39 (patch)
treeb605969bcc42abc34f71cd2f5d93a6d4fd0e7151 /t/app/controller/admin
parent4fb17bc32eda72ad8649b0218a37f4e9b50b5085 (diff)
parentc6b480d08c7aa9f8a08467e2631f7daa30b3be7e (diff)
Merge branch 'issues/2475-multiple-parents-for-categories'
Diffstat (limited to 't/app/controller/admin')
-rw-r--r--t/app/controller/admin/bodies.t43
1 files changed, 34 insertions, 9 deletions
diff --git a/t/app/controller/admin/bodies.t b/t/app/controller/admin/bodies.t
index f67e45bf6..db53b7cda 100644
--- a/t/app/controller/admin/bodies.t
+++ b/t/app/controller/admin/bodies.t
@@ -1,10 +1,3 @@
-package FixMyStreet::Cobrand::Tester;
-
-use parent 'FixMyStreet::Cobrand::Default';
-
-sub enable_category_groups { 1 }
-
-package main;
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
@@ -210,10 +203,12 @@ subtest 'check text output' => sub {
}; # END of override wrap
FixMyStreet::override_config {
- ALLOWED_COBRANDS => ['tester'],
MAPIT_URL => 'http://mapit.uk/',
MAPIT_TYPES => [ 'UTA' ],
BASE_URL => 'http://www.example.org',
+ COBRAND_FEATURES => {
+ category_groups => { default => 1 },
+ }
}, sub {
subtest 'group editing works' => sub {
$mech->get_ok('/admin/body/' . $body->id);
@@ -229,7 +224,7 @@ FixMyStreet::override_config {
} } );
my $contact = $body->contacts->find({ category => 'grouped category' });
- is $contact->get_extra_metadata('group'), 'group a', "group stored correctly";
+ is_deeply $contact->get_extra_metadata('group'), ['group a'], "group stored correctly";
};
subtest 'group can be unset' => sub {
@@ -251,5 +246,35 @@ FixMyStreet::override_config {
};
+FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.uk/',
+ MAPIT_TYPES => [ 'UTA' ],
+ BASE_URL => 'http://www.example.org',
+ COBRAND_FEATURES => {
+ category_groups => { default => 1 },
+ multiple_category_groups => { default => 1 },
+ }
+}, sub {
+ subtest 'multi group editing works' => sub {
+ $mech->get_ok('/admin/body/' . $body->id);
+ $mech->content_contains( 'group</strong> is used for the top-level category' );
+
+ # have to do this as a post as adding a second group requires
+ # javascript
+ $mech->post_ok( '/admin/body/' . $body->id, {
+ posted => 'new',
+ token => $mech->form_id('category_edit')->value('token'),
+ category => 'grouped category',
+ email => 'test@example.com',
+ note => 'test note',
+ 'group' => [ 'group a', 'group b'],
+ non_public => undef,
+ state => 'unconfirmed',
+ } );
+
+ my $contact = $body->contacts->find({ category => 'grouped category' });
+ is_deeply $contact->get_extra_metadata('group'), ['group a', 'group b'], "group stored correctly";
+ };
+};
done_testing();