diff options
Diffstat (limited to 't/cobrand')
-rw-r--r-- | t/cobrand/bexley.t | 16 | ||||
-rw-r--r-- | t/cobrand/hounslow.t | 39 |
2 files changed, 50 insertions, 5 deletions
diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t index e6f400e3d..2f74ac03a 100644 --- a/t/cobrand/bexley.t +++ b/t/cobrand/bexley.t @@ -12,10 +12,18 @@ $ukc->mock('lookup_site_code', sub { return "Road ID"; }); -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 ]; +FixMyStreet::override_config { + COBRAND_FEATURES => { + contact_email => { + bexley => 'foo@bexley', + } + }, +}, sub { + 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; diff --git a/t/cobrand/hounslow.t b/t/cobrand/hounslow.t index 5d9f022e7..8fac848b1 100644 --- a/t/cobrand/hounslow.t +++ b/t/cobrand/hounslow.t @@ -3,6 +3,20 @@ use FixMyStreet::TestMech; ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' ); my $hounslow_id = $mech->create_body_ok(2483, 'Hounslow Borough Council')->id; +$mech->create_contact_ok( + body_id => $hounslow_id, + category => 'Potholes', + email => 'pothole@example.org', +); + +$mech->create_user_ok('staff@example.org', from_body => $hounslow_id); + +my $tfl = $mech->create_body_ok( 2483, 'TfL'); +$mech->create_contact_ok( + body_id => $tfl->id, + category => 'Traffic lights', + email => 'tfl@example.org', +); $mech->create_problems_for_body(1, $hounslow_id, 'An old problem made before Hounslow FMS launched', { confirmed => '2018-12-25 09:00', @@ -11,7 +25,8 @@ $mech->create_problems_for_body(1, $hounslow_id, 'An old problem made before Hou $mech->create_problems_for_body(1, $hounslow_id, 'A brand new problem made on the Hounslow site', { cobrand => 'hounslow' }); -$mech->create_problems_for_body(1, $hounslow_id, 'A brand new problem made on fixmystreet.com', { +my ($report) = $mech->create_problems_for_body(1, $hounslow_id, 'A brand new problem made on fixmystreet.com', { + external_id => 'ABC123', cobrand => 'fixmystreet' }); @@ -41,4 +56,26 @@ subtest "it does not show old reports on Hounslow" => sub { }; }; +subtest "does not show TfL traffic lights category" => sub { + FixMyStreet::override_config { + MAPIT_URL => 'http://mapit.uk/', + ALLOWED_COBRANDS => 'fixmystreet', + }, sub { + my $json = $mech->get_ok_json('/report/new/ajax?latitude=51.482286&longitude=-0.328163'); + is $json->{by_category}{"Traffic lights"}, undef; + }; +}; + +subtest "Shows external ID on report page to staff users only" => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => 'hounslow', + }, sub { + $mech->get_ok('/report/' . $report->id); + $mech->content_lacks('ABC123'); + $mech->log_in_ok('staff@example.org'); + $mech->get_ok('/report/' . $report->id); + $mech->content_contains('ABC123'); + }; +}; + done_testing(); |