diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-03-31 14:23:02 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-03-31 14:23:02 +0100 |
commit | ed850c6d928acfa6898d67a9220b00ade64b45ea (patch) | |
tree | 33e94f379b1c60dcdfe35afe4d5d9f53ac1b591f /t | |
parent | 3d967f09d8171b283c9a90afa6407dc033e4ae42 (diff) |
[SeeSomething] Remove cobrand.
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/report_new.t | 115 | ||||
-rw-r--r-- | t/cobrand/seesomething.t | 87 |
2 files changed, 0 insertions, 202 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index fd3108438..71090cd26 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -1363,121 +1363,6 @@ subtest "test Hart" => sub { } }; -subtest "test SeeSomething" => sub { - $mech->host('seesomething.fixmystreet.com'); - $mech->clear_emails_ok; - $mech->log_out_ok; - - my $cobrand = FixMyStreet::Cobrand::SeeSomething->new(); - - my $body_ss = $mech->create_body_ok(2535, 'Sandwell Borough Council', id => 2535); - my $bus_contact = $mech->create_contact_ok( - body_id => $body_ss->id, - category => 'Bus', - email => 'bus@example.com', - non_public => 1, - ); - - for my $test ( { - desc => 'report with no user details works', - pc => 'WS1 4NH', - fields => { - detail => 'Test report details', - category => 'Bus', - subcategory => 'Smoking', - }, - email => $cobrand->anonymous_account->{email}, - }, - { - desc => 'report with user details works', - pc => 'WS1 4NH', - fields => { - detail => 'Test report details', - category => 'Bus', - subcategory => 'Smoking', - email => 'non_anon_user@example.com', - name => 'Non Anon', - }, - email => 'non_anon_user@example.com', - }, - { - desc => 'report with public category', - pc => 'WS1 4NH', - fields => { - detail => 'Test report details', - category => 'Bus', - subcategory => 'Smoking', - }, - email => $cobrand->anonymous_account->{email}, - public => 1, - } - ) { - subtest $test->{desc} => sub { - $mech->clear_emails_ok; - my $user = - FixMyStreet::App->model('DB::User')->find( { email => $test->{email} } ); - - if ( $user ) { - $user->alerts->delete; - $user->problems->delete; - $user->delete; - } - - if ( $test->{public} ) { - $bus_contact->non_public(0); - $bus_contact->update; - } else { - $bus_contact->non_public(1); - $bus_contact->update; - } - - $mech->get_ok( '/around' ); - FixMyStreet::override_config { - ALLOWED_COBRANDS => [ 'seesomething' ], - MAPIT_URL => 'http://mapit.uk/', - }, sub { - $mech->submit_form_ok( - { - with_fields => { - pc => $test->{pc}, - }, - }, - 'submit around form', - ); - $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" ); - - $mech->submit_form_ok( - { - with_fields => $test->{fields}, - }, - 'Submit form details with no user details', - ); - }; - is_deeply $mech->page_errors, [], "check there were no errors"; - - $user = - FixMyStreet::App->model('DB::User')->find( { email => $test->{email} } ); - ok $user, "user found"; - - my $report = $user->problems->first; - ok $report, "Found the report"; - - $mech->email_count_is(0); - - ok $report->confirmed, 'Report is confirmed automatically'; - - is $mech->uri->path, '/report/new', 'stays on report/new page'; - $mech->content_contains( 'Your report has been sent', 'use report created template' ); - - $user->alerts->delete; - $user->problems->delete; - $user->delete; - }; - } - - $bus_contact->delete; -}; - subtest "categories from deleted bodies shouldn't be visible for new reports" => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], diff --git a/t/cobrand/seesomething.t b/t/cobrand/seesomething.t deleted file mode 100644 index 4da1c9c6e..000000000 --- a/t/cobrand/seesomething.t +++ /dev/null @@ -1,87 +0,0 @@ -use strict; -use warnings; -use DateTime; -use Test::More; - -use FixMyStreet; -use FixMyStreet::TestMech; - -my $EMAIL = 'seesomething@example.com'; - -my $mech = FixMyStreet::TestMech->new; -my $db = FixMyStreet::DB->storage->schema; -my $dt_parser = $db->storage->datetime_parser; - -$db->txn_begin; - -$db->resultset('Comment')->delete; -$db->resultset('Problem')->delete; - -my $user = $mech->create_user_ok( $EMAIL ); - -my $body = $mech->create_body_ok( 2520, 'Coventry City Council', id => 2520 ); -$mech->create_body_ok( 2522, 'Dudley Borough Council' ); -$mech->create_body_ok( 2514, 'Birmingham City Council' ); -$mech->create_body_ok( 2546, 'Walsall Borough Council' ); -$mech->create_body_ok( 2519, 'Wolverhampton City Council' ); -$mech->create_body_ok( 2538, 'Solihull Borough Council' ); -$mech->create_body_ok( 2535, 'Sandwell Borough Council' ); - -$user->update({ from_body => $body }); - -my $date = $dt_parser->format_datetime(DateTime->now); - -my $report = FixMyStreet::DB->resultset('Problem')->find_or_create( { - postcode => 'EH1 1BB', - bodies_str => '2520', - areas => ',2520,', - service => 'Android', - category => 'Bus', - subcategory => 'Loud Music', - title => 'Loud Music', - detail => 'Loud Music', - used_map => 1, - name => 'SeeSomething Test User', - anonymous => 0, - state => 'confirmed', - confirmed => $date, - lang => 'en-gb', - cobrand => 'default', - cobrand_data => '', - send_questionnaire => 1, - latitude => '52.4081', - longitude => '-1.5106', - user_id => $user->id, -} ); - -subtest 'admin/stats' => sub { - FixMyStreet::override_config { - ALLOWED_COBRANDS => [ 'seesomething' ], - }, sub { - my $user = $mech->log_in_ok( $EMAIL ); - - $mech->get( '/admin/stats' ); - if (ok $mech->success) { - - $date =~s/ / /; - $date =~s/\+0000//; - my $xml = <<EOXML; - <tr> - <td>Android</td> - <td>Bus</td> - <td class="nowrap">Loud Music</td> - <td class="nowrap">Coventry </td> - <td class="nowrap">$date</td> - </tr> -EOXML - $mech->content_contains($xml); - } - else { - diag $mech->content; - diag $mech->status; - }; - } -}; - -$db->txn_rollback; -done_testing; |