aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/cobrand/bexley.t32
-rw-r--r--t/open311/post-service-request-updates.t25
2 files changed, 57 insertions, 0 deletions
diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t
new file mode 100644
index 000000000..7f67dc1a4
--- /dev/null
+++ b/t/cobrand/bexley.t
@@ -0,0 +1,32 @@
+use FixMyStreet::TestMech;
+
+use_ok 'FixMyStreet::Cobrand::Bexley';
+
+my $cobrand = FixMyStreet::Cobrand::Bexley->new;
+like $cobrand->contact_email, qr/bexley/;
+is $cobrand->on_map_default_status, 'open';
+is_deeply $cobrand->disambiguate_location->{bounds}, [ 51.408484, 0.074653, 51.515542, 0.2234676 ];
+
+my $mech = FixMyStreet::TestMech->new;
+
+$mech->create_body_ok(2494, 'London Borough of Bexley');
+
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'bexley' ],
+ MAPIT_URL => 'http://mapit.uk/',
+}, sub {
+
+ subtest 'cobrand displays council name' => sub {
+ ok $mech->host("bexley.fixmystreet.com"), "change host to bexley";
+ $mech->get_ok('/');
+ $mech->content_contains('Bexley');
+ };
+
+ subtest 'cobrand displays council name' => sub {
+ $mech->get_ok('/reports/Bexley');
+ $mech->content_contains('Bexley');
+ };
+
+};
+
+done_testing();
diff --git a/t/open311/post-service-request-updates.t b/t/open311/post-service-request-updates.t
index 6a7bc6ff2..ac6fb870c 100644
--- a/t/open311/post-service-request-updates.t
+++ b/t/open311/post-service-request-updates.t
@@ -62,6 +62,7 @@ my $other_user = $mech->create_user_ok('test2@example.com', title => 'MRS');
sub c {
my ($p, $user) = @_;
my $c = $mech->create_comment_for_problem($p, $user || $p->user, 'Name', 'Update text', 'f', 'confirmed', 'confirmed', { confirmed => \'current_timestamp' });
+ $c->discard_changes;
return $c;
}
@@ -96,6 +97,30 @@ subtest 'Send comments' => sub {
};
};
+subtest 'Check Bexley munging' => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => ['fixmystreet', 'bexley'],
+ }, sub {
+ my $bexley = $mech->create_body_ok(2494, 'Bexley', $params);
+ $mech->create_contact_ok(body_id => $bexley->id, category => 'Other', email => "OTHER");
+
+ my $test_res = HTTP::Response->new();
+ $test_res->code(200);
+ $test_res->message('OK');
+ $test_res->content('<?xml version="1.0" encoding="utf-8"?><service_request_updates><request_update><update_id>248</update_id></request_update></service_request_updates>');
+ my $o = Open311->new(
+ fixmystreet_body => $bexley,
+ test_mode => 1,
+ test_get_returns => { 'servicerequestupdates.xml' => $test_res },
+ );
+ my ($p5, $c5) = p_and_c($bexley);
+ my $id = $o->post_service_request_update($c5);
+ is $id, 248, 'correct update ID returned';
+ like $o->test_req_used->content, qr/service_code=OTHER/, 'Service code included';
+ };
+};
+
+
subtest 'Oxfordshire gets an ID' => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => ['fixmystreet', 'bromley', 'buckinghamshire', 'lewisham', 'oxfordshire'],