diff options
author | Dave Arter <davea@mysociety.org> | 2019-11-26 14:36:17 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2019-12-09 12:48:12 +0000 |
commit | 9f99597cb802c800fcb4e3e06ec153182c004be4 (patch) | |
tree | 8915d6b30cd2bf0862734eea828813d3ce121d1a /t/app/controller | |
parent | 61665b040781a0920b9586c558313cdeb17a99d6 (diff) |
Group categories on response template edit page, if cobrand allows
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/admin/templates.t | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/t/app/controller/admin/templates.t b/t/app/controller/admin/templates.t index ca1cba46d..ac915af94 100644 --- a/t/app/controller/admin/templates.t +++ b/t/app/controller/admin/templates.t @@ -8,6 +8,7 @@ my $superuser = $mech->create_user_ok('superuser@example.com', name => 'Super Us my $oxfordshire = $mech->create_body_ok(2237, 'Oxfordshire County Council'); my $oxfordshirecontact = $mech->create_contact_ok( body_id => $oxfordshire->id, category => 'Potholes', email => 'potholes@example.com' ); +my $oxfordshirecontact2 = $mech->create_contact_ok( body_id => $oxfordshire->id, category => 'Flytipping', email => 'flytipping@example.com' ); my $oxfordshireuser = $mech->create_user_ok('counciluser@example.com', name => 'Council User', from_body => $oxfordshire); my $bromley = $mech->create_body_ok(2482, 'Bromley Borough Council'); @@ -282,6 +283,50 @@ subtest "templates that set state and external_status_code can't be added" => su is $oxfordshire->response_templates->count, 0, "Invalid response template wasn't added"; }; +subtest "category groups are shown" => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'oxfordshire' ], + COBRAND_FEATURES => { + category_groups => { + oxfordshire => 1, + }, + multiple_category_groups => { + oxfordshire => 1, + }, + }, + }, sub { + + $mech->log_in_ok( $superuser->email ); + + $mech->get_ok( "/admin/templates/" . $oxfordshire->id . "/new" ); + $mech->content_contains("No Group") or diag $mech->content; + $mech->content_lacks("Multiple Groups"); + $mech->content_lacks("These categories appear in more than one group:"); + + $oxfordshirecontact->set_extra_metadata( group => [ 'Highways' ] ); + $oxfordshirecontact->update; + $oxfordshirecontact2->set_extra_metadata( group => [ 'Street Cleaning' ] ); + $oxfordshirecontact2->update; + $mech->get_ok( "/admin/templates/" . $oxfordshire->id . "/new" ); + $mech->content_lacks("No Group"); + $mech->content_lacks("Multiple Groups"); + $mech->content_lacks("These categories appear in more than one group:"); + $mech->content_contains("Highways"); + $mech->content_contains("Street Cleaning"); + + $oxfordshirecontact->set_extra_metadata( group => [ 'Highways', 'Roads & Pavements' ] ); + $oxfordshirecontact->update; + $oxfordshirecontact2->set_extra_metadata( group => [ 'Street Cleaning' ] ); + $oxfordshirecontact2->update; + $mech->get_ok( "/admin/templates/" . $oxfordshire->id . "/new" ); + $mech->content_lacks("No Group"); + $mech->content_contains("Multiple Groups"); + $mech->content_contains("These categories appear in more than one group:"); + $mech->content_contains("Highways; Roads & Pavements"); + $mech->content_contains("Street Cleaning"); + }; +}; + subtest "TfL cobrand only shows TfL templates" => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'tfl' ], |