aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/Mock/MapIt.pm2
-rw-r--r--t/cobrand/hackney.t27
2 files changed, 29 insertions, 0 deletions
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm
index 760e0ba52..74e360974 100644
--- a/t/Mock/MapIt.pm
+++ b/t/Mock/MapIt.pm
@@ -122,6 +122,8 @@ sub dispatch_request {
$self->output({2326 => {parent_area => undef, id => 2326, name => "Cheltenham Borough Council", type => "DIS"}});
} elsif ($areas eq 'UTA') {
$self->output({2650 => {parent_area => undef, id => 2650, name => "Aberdeen Council", type => "UTA"}});
+ } elsif ($areas eq 'DIS,LBO,MTD,UTA,CTY,COI,LGD') {
+ $self->output({2508 => {parent_area => undef, id => 2508, name => "Hackney Council", type => "LBO"}});
} elsif ($areas eq 'GRE') {
$self->output({2493 => {parent_area => undef, id => 2493, name => "Greenwich Borough Council", type => "LBO"}});
} elsif ($areas eq 'LBO') {
diff --git a/t/cobrand/hackney.t b/t/cobrand/hackney.t
index 374bf2ea9..6ab47a7ce 100644
--- a/t/cobrand/hackney.t
+++ b/t/cobrand/hackney.t
@@ -48,6 +48,10 @@ $hackney_user->user_body_permissions->create({
body => $hackney,
permission_type => 'moderate',
});
+$hackney_user->user_body_permissions->create({
+ body => $hackney,
+ permission_type => 'category_edit',
+});
my $contact2 = $mech->create_contact_ok(
body_id => $hackney->id,
@@ -291,5 +295,28 @@ subtest "check category extra uses correct name" => sub {
like $extra_details->{category_extra}, qr/Hackney Council/, 'correct name in category extras';
};
+subtest "can edit special destination email addresses" => sub {
+ FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.uk/',
+ ALLOWED_COBRANDS => ['hackney'],
+ COBRAND_FEATURES => { anonymous_account => { hackney => 'anonymous' } },
+ }, sub {
+ $contact2->update({ send_method => 'Email' });
+ $mech->log_in_ok( $hackney_user->email );
+ $mech->get_ok("/admin/body/" . $hackney->id . "/" . $contact2->category);
+ $mech->submit_form_ok( { with_fields => { email => 'park:parks@example.com;estate:estates@example;other:new@example.org' } },
+ "submit valid new email address");
+ $mech->content_lacks("Please enter a valid email");
+ $contact2->discard_changes;
+ is $contact2->email, 'park:parks@example.com;estate:estates@example;other:new@example.org', "New email addresses saved";
+
+ $mech->get_ok("/admin/body/" . $hackney->id . "/" . $contact2->category);
+ $mech->submit_form_ok( { with_fields => { email => 'invalid' } },
+ "submit invalid new email address");
+ $mech->content_contains("Please enter a valid email");
+ $contact2->discard_changes;
+ is $contact2->email, 'park:parks@example.com;estate:estates@example;other:new@example.org', "Invalid email addresses not saved";
+ };
+};
done_testing();