diff options
author | Dave Arter <davea@mysociety.org> | 2017-06-28 11:06:13 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-12-13 16:25:31 +0000 |
commit | 36d62c1bd83aa9e164edcc8a7e6c344cc7b07fda (patch) | |
tree | 2dcfa487b3e3050f0d47bf87c8b35f647285b297 /t/app/controller/report_new.t | |
parent | a3dc1964d8cd0e1a1126838636ae6c5e368433a1 (diff) |
Bypass /around from postcode form if required.
Cobrands can provide a `skip_around_page` method which means the user will be
taken from the front page form directly to /report/new with a pin in the map
at the location entered.
This also preserves the category parameter, if specified on the front page form.
Fixes #1730.
Diffstat (limited to 't/app/controller/report_new.t')
-rw-r--r-- | t/app/controller/report_new.t | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index f741ec796..e0fe205bd 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -1056,6 +1056,51 @@ subtest "check that a lat/lon off coast leads to /around" => sub { }; +subtest "check we load a partial report correctly" => sub { + my $user = FixMyStreet::App->model('DB::User')->find_or_create( + { + email => 'test-partial@example.com' + } + ); + + my $report = FixMyStreet::App->model('DB::Problem')->create( { + name => '', + postcode => '', + category => 'Street lighting', + title => 'Testing', + detail => "Testing Detail", + anonymous => 0, + state => 'partial', + lang => 'en-gb', + service => '', + areas => '', + used_map => 1, + latitude => '51.754926', + longitude => '-1.256179', + user_id => $user->id, + } ); + + my $report_id = $report->id; + + my $token = FixMyStreet::App->model("DB::Token") + ->create( { scope => 'partial', data => $report->id } ); + + my $token_code = $token->token; + + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], + MAPIT_URL => 'http://mapit.uk/', + }, + sub { + $mech->get("/L/$token_code"); + is $mech->res->previous->code, 302, 'partial token page redirects'; + is $mech->uri->path, "/report/new", "partial redirects to report page"; + $mech->content_contains('Testing Detail'); + }; + + $mech->delete_user($user); +}; + for my $test ( { desc => 'user title not set if not bromley problem', |