aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-02-10 13:13:42 +0000
committerMatthew Somerville <matthew@mysociety.org>2020-02-24 09:52:47 +0000
commitf312a56abb68f0cc3d5b554f259968d7a174a14a (patch)
tree4fd7fe5b3b741cdc4db9052ce98456a0635143d8 /t/cobrand
parent38ac8f605f4eeb7aa53859bd5b455a1cfe81ff73 (diff)
[TfL] Allow bus stop reports outside London.
After this change, you can safely add the TfL body to other councils (namely the ones surrounding London that include TfL bus stops); clicking in those councils on other cobrands will have no change, as the TfL body will be fully ignored on a non-London council, but on the TfL cobrand it will allow it for e.g. the selection of bus stops outside London. It removes the body rather than just all its categories to prevent a "We do not have details of the other body covering this area" message appearing.
Diffstat (limited to 't/cobrand')
-rw-r--r--t/cobrand/tfl.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t
index cdf3b1bab..8ddc3d671 100644
--- a/t/cobrand/tfl.t
+++ b/t/cobrand/tfl.t
@@ -19,6 +19,10 @@ FixMyStreet::DB->resultset('BodyArea')->find_or_create({
area_id => 2483, # Hounslow
body_id => $body->id,
});
+FixMyStreet::DB->resultset('BodyArea')->find_or_create({
+ area_id => 2457, # Epsom Ewell, outside London, for bus stop test
+ body_id => $body->id,
+});
my $superuser = $mech->create_user_ok('superuser@example.com', name => 'Super User', is_superuser => 1);
my $staffuser = $mech->create_user_ok('counciluser@example.com', name => 'Council User', from_body => $body, password => 'password');
$staffuser->user_body_permissions->create({
@@ -341,6 +345,40 @@ subtest "test report creation and reference number" => sub {
is $report->bodies_str, $body->id;
is $report->name, 'Joe Bloggs';
+};
+
+subtest "test bus report creation outside London, .com" => sub {
+ $mech->host('www.fixmystreet.com');
+ $mech->get_ok('/report/new?latitude=51.345714&longitude=-0.227959');
+ $mech->content_lacks('Bus things');
+ $mech->host('tfl.fixmystreet.com');
+};
+
+subtest "test bus report creation outside London" => sub {
+ $mech->get_ok('/report/new?latitude=51.345714&longitude=-0.227959');
+ $mech->submit_form_ok(
+ {
+ with_fields => {
+ # A bus stop in East Ewell
+ latitude => 51.345714,
+ longitude => -0.227959,
+ title => 'Test outwith London',
+ detail => 'Test report details.',
+ name => 'Joe Bloggs',
+ may_show_name => '1',
+ category => 'Bus stops',
+ }
+ },
+ "submit good details"
+ );
+ $mech->content_contains('Your issue is on its way to Transport for London');
+ is_deeply $mech->page_errors, [], "check there were no errors";
+
+ my $report = FixMyStreet::DB->resultset("Problem")->find({ title => 'Test outwith London'});
+ ok $report, "Found the report";
+ is $report->state, 'confirmed', "report confirmed";
+ is $report->bodies_str, $body->id;
+ $report->delete;
$mech->log_out_ok;
};