aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand
diff options
context:
space:
mode:
Diffstat (limited to 't/cobrand')
-rw-r--r--t/cobrand/bristol.t44
-rw-r--r--t/cobrand/bromley.t13
-rw-r--r--t/cobrand/closest.t41
-rw-r--r--t/cobrand/councils.t4
-rw-r--r--t/cobrand/fixamingata.t9
-rw-r--r--t/cobrand/form_extras.t5
-rw-r--r--t/cobrand/get_body_sender.t10
-rw-r--r--t/cobrand/hart.t4
-rw-r--r--t/cobrand/loading.t4
-rw-r--r--t/cobrand/oxfordshire.t191
-rw-r--r--t/cobrand/restriction.t2
-rw-r--r--t/cobrand/two_tier.t10
-rw-r--r--t/cobrand/zurich.t32
13 files changed, 260 insertions, 109 deletions
diff --git a/t/cobrand/bristol.t b/t/cobrand/bristol.t
new file mode 100644
index 000000000..b4b6ed4ac
--- /dev/null
+++ b/t/cobrand/bristol.t
@@ -0,0 +1,44 @@
+use FixMyStreet::TestMech;
+my $mech = FixMyStreet::TestMech->new;
+
+# Create test data
+my $body = $mech->create_body_ok( 2561, 'Bristol County Council', {
+ send_method => 'Open311',
+ can_be_devolved => 1
+});
+
+my $open311_contact = $mech->create_contact_ok(
+ body_id => $body->id,
+ category => 'Street Lighting',
+ email => 'LIGHT',
+);
+my $email_contact = $mech->create_contact_ok(
+ body_id => $body->id,
+ category => 'Potholes',
+ email => 'potholes@example.org',
+ send_method => 'Email'
+);
+
+subtest 'Only Open311 categories are shown on Bristol cobrand', sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'bristol' ],
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $mech->get_ok("/report/new/ajax?latitude=51.494885&longitude=-2.602237");
+ $mech->content_contains($open311_contact->category);
+ $mech->content_lacks($email_contact->category);
+ };
+};
+
+subtest 'All categories are shown on FMS cobrand', sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmystreet' ],
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $mech->get_ok("/report/new/ajax?latitude=51.494885&longitude=-2.602237");
+ $mech->content_contains($open311_contact->category);
+ $mech->content_contains($email_contact->category);
+ };
+};
+
+done_testing();
diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t
index a7cc563dc..f3053c29a 100644
--- a/t/cobrand/bromley.t
+++ b/t/cobrand/bromley.t
@@ -1,14 +1,10 @@
-use strict;
-use warnings;
-use Test::More;
-
use CGI::Simple;
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
# Create test data
my $user = $mech->create_user_ok( 'bromley@example.com' );
-my $body = $mech->create_body_ok( 2482, 'Bromley Council', id => 2482 );
+my $body = $mech->create_body_ok( 2482, 'Bromley Council');
my $contact = $mech->create_contact_ok(
body_id => $body->id,
category => 'Other',
@@ -45,9 +41,9 @@ for my $update ('in progress', 'unable to fix') {
# Test Bromley special casing of 'unable to fix'
$mech->get_ok( '/report/' . $report->id );
$mech->content_contains( 'marks it as in progress' );
-$mech->content_contains( 'marked as in progress' );
+$mech->content_contains( 'State changed to: In progress' );
$mech->content_contains( 'marks it as unable to fix' );
-$mech->content_contains( 'marked as no further action' );
+$mech->content_contains( 'State changed to: No further action' );
subtest 'testing special Open311 behaviour', sub {
$report->set_extra_fields();
@@ -132,7 +128,4 @@ for my $test (
};
}
-# Clean up
-$mech->delete_user($user);
-$mech->delete_body($body);
done_testing();
diff --git a/t/cobrand/closest.t b/t/cobrand/closest.t
index 43b36f608..36fe78a01 100644
--- a/t/cobrand/closest.t
+++ b/t/cobrand/closest.t
@@ -1,9 +1,5 @@
-use strict;
-use warnings;
+use t::Mock::Bing;
-use Test::More;
-
-use mySociety::Locale;
use FixMyStreet::DB;
use FixMyStreet::TestMech;
@@ -11,8 +7,6 @@ my $mech = FixMyStreet::TestMech->new;
use_ok 'FixMyStreet::Cobrand';
-mySociety::Locale::gettext_domain( 'FixMyStreet' );
-
my $c = FixMyStreet::Cobrand::UK->new();
my $user =
@@ -31,7 +25,7 @@ my $dt = DateTime->new(
my $report = FixMyStreet::DB->resultset('Problem')->find_or_create(
{
- postcode => 'SW1A 1AA',
+ postcode => 'E142DN',
bodies_str => '2504',
areas => ',105255,11806,11828,2247,2504,',
category => 'Other',
@@ -47,8 +41,8 @@ my $report = FixMyStreet::DB->resultset('Problem')->find_or_create(
cobrand => 'default',
cobrand_data => '',
send_questionnaire => 't',
- latitude => '51.5016605453401',
- longitude => '-0.142497580865087',
+ latitude => 51.508536,
+ longitude => 0.000001,
user_id => $user->id,
}
);
@@ -56,33 +50,30 @@ my $report_id = $report->id;
ok $report, "created test report - $report_id";
$report->geocode( undef );
-
ok !$report->geocode, 'no geocode entry for report';
-my $near = $c->find_closest( $report->latitude, $report->longitude, $report );
-
-SKIP: {
- if (!FixMyStreet->config('BING_MAPS_API_KEY')) {
- skip 'No Bing Maps key', 0;
- }
-
+FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.uk/',
+ BING_MAPS_API_KEY => 'test',
+}, sub {
+ my $near = $c->find_closest($report);
ok $report->geocode, 'geocode entry added to report';
ok $report->geocode->{resourceSets}, 'geocode entry looks like right sort of thing';
like $near, qr/Constitution Hill/i, 'nearest street looks right';
- like $near, qr/Nearest postcode .*: SW1A 1AA/i, 'nearest postcode looks right';
+ like $near, qr/Nearest postcode .*: E14 2DN/i, 'nearest postcode looks right';
- $near = $c->find_closest_address_for_rss( $report->latitude, $report->longitude, $report );
+ $near = $c->find_closest_address_for_rss($report);
like $near, qr/Constitution Hill/i, 'nearest street for RSS looks right';
unlike $near, qr/Nearest postcode/i, 'no nearest postcode in RSS text';
$report->geocode( undef );
- $near = $c->find_closest_address_for_rss( $report->latitude, $report->longitude, $report );
+ $near = $c->find_closest_address_for_rss($report);
ok !$near, 'no closest address for RSS if not cached';
-}
+};
-# all done
-$mech->delete_user( $user );
-done_testing();
+END {
+ done_testing();
+}
diff --git a/t/cobrand/councils.t b/t/cobrand/councils.t
index 0e8b71f04..4de8bbf2e 100644
--- a/t/cobrand/councils.t
+++ b/t/cobrand/councils.t
@@ -1,7 +1,3 @@
-use strict;
-use warnings;
-use Test::More;
-
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
diff --git a/t/cobrand/fixamingata.t b/t/cobrand/fixamingata.t
index d6a1c2b34..1e6bd7e65 100644
--- a/t/cobrand/fixamingata.t
+++ b/t/cobrand/fixamingata.t
@@ -1,13 +1,5 @@
-use strict;
-use warnings;
-use Test::More;
use Test::MockModule;
-BEGIN {
- use FixMyStreet;
- FixMyStreet->test_mode(1);
-}
-
use mySociety::Locale;
use FixMyStreet::TestMech;
@@ -115,7 +107,6 @@ subtest "Test ajax decimal points" => sub {
};
END {
- $mech->delete_body($body);
ok $mech->host("www.fixmystreet.com"), "change host back";
done_testing();
}
diff --git a/t/cobrand/form_extras.t b/t/cobrand/form_extras.t
index 22a86ef21..f450d908e 100644
--- a/t/cobrand/form_extras.t
+++ b/t/cobrand/form_extras.t
@@ -1,6 +1,3 @@
-use strict;
-use warnings;
-
package FixMyStreet::Cobrand::Tester;
use parent 'FixMyStreet::Cobrand::FixMyStreet';
@@ -18,7 +15,6 @@ sub path_to_web_templates {
package main;
-use Test::More;
use FixMyStreet::TestMech;
# disable info logs for this test run
@@ -67,6 +63,5 @@ FixMyStreet::override_config {
};
END {
- $mech->delete_problems_for_body(undef);
done_testing();
}
diff --git a/t/cobrand/get_body_sender.t b/t/cobrand/get_body_sender.t
index fbdfbffa7..06ffb42a5 100644
--- a/t/cobrand/get_body_sender.t
+++ b/t/cobrand/get_body_sender.t
@@ -1,15 +1,9 @@
-use strict;
-use warnings;
+use FixMyStreet::Test;
-use Test::More;
-
-use mySociety::Locale;
use FixMyStreet::DB;
use_ok 'FixMyStreet::Cobrand';
-mySociety::Locale::gettext_domain( 'FixMyStreet' );
-
my $c = FixMyStreet::Cobrand::FixMyStreet->new();
FixMyStreet::DB->resultset('BodyArea')->search( { body_id => 1000 } )->delete;
@@ -23,7 +17,7 @@ my $body_area = $body->body_areas->find_or_create({ area_id => 1000 });
FixMyStreet::override_config {
MAPIT_TYPES => [ 'LBO' ],
- MAPIT_URL => 'http://mapit.mysociety.org/',
+ MAPIT_URL => 'http://mapit.uk/', # Not actually used as no special casing at present
}, sub {
is_deeply $c->get_body_sender( $body ), { method => 'Email', contact => undef }, 'defaults to email';
$body_area->update({ area_id => 2481 }); # Croydon LBO
diff --git a/t/cobrand/hart.t b/t/cobrand/hart.t
index f4a2473eb..d1681a537 100644
--- a/t/cobrand/hart.t
+++ b/t/cobrand/hart.t
@@ -1,7 +1,3 @@
-use strict;
-use warnings;
-use Test::More;
-
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
diff --git a/t/cobrand/loading.t b/t/cobrand/loading.t
index b4738fb63..16c7b4ab7 100644
--- a/t/cobrand/loading.t
+++ b/t/cobrand/loading.t
@@ -1,7 +1,5 @@
-use strict;
-use warnings;
+use FixMyStreet::Test;
-use Test::More;
use Sub::Override;
use FixMyStreet;
diff --git a/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t
index b0fad3b56..a79a8f2a4 100644
--- a/t/cobrand/oxfordshire.t
+++ b/t/cobrand/oxfordshire.t
@@ -1,16 +1,19 @@
-use strict;
-use warnings;
-use Test::More;
+
+use Test::MockModule;
+use FixMyStreet::Integrations::ExorRDI;
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
+my $oxon = $mech->create_body_ok(2237, 'Oxfordshire County Council');
+
subtest 'check /ajax defaults to open reports only' => sub {
my $categories = [ 'Bridges', 'Fences', 'Manhole' ];
my $params = {
postcode => 'OX28 4DS',
- latitude => 51.7847208192,
- longitude => -1.49445264029,
+ cobrand => 'oxfordshire',
+ latitude => 51.784721,
+ longitude => -1.494453,
};
my $bbox = ($params->{longitude} - 0.01) . ',' . ($params->{latitude} - 0.01)
. ',' . ($params->{longitude} + 0.01) . ',' . ($params->{latitude} + 0.01);
@@ -23,13 +26,12 @@ subtest 'check /ajax defaults to open reports only' => sub {
category => $category,
state => $state,
);
- $mech->create_problems_for_body( 1, 2237, 'Around page', \%report_params );
+ $mech->create_problems_for_body( 1, $oxon->id, 'Around page', \%report_params );
}
}
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ { 'oxfordshire' => '.' } ],
- MAPIT_URL => 'http://mapit.mysociety.org/',
}, sub {
my $json = $mech->get_ok_json( '/ajax?status=all&bbox=' . $bbox );
my $pins = $json->{pins};
@@ -46,6 +48,10 @@ subtest 'check /ajax defaults to open reports only' => sub {
};
my $superuser = $mech->create_user_ok('superuser@example.com', name => 'Super User', is_superuser => 1);
+my $inspector = $mech->create_user_ok('inspector@example.com', name => 'Inspector');
+$inspector->user_body_permissions->create({ body => $oxon, permission_type => 'report_inspect' });
+
+my @problems = FixMyStreet::DB->resultset('Problem')->search({}, { rows => 3 })->all;
subtest 'Exor RDI download appears on Oxfordshire cobrand admin' => sub {
FixMyStreet::override_config {
@@ -57,7 +63,7 @@ subtest 'Exor RDI download appears on Oxfordshire cobrand admin' => sub {
}
};
-subtest 'Exor RDI download doesn’t appear outside of Oxfordshire cobrand admin' => sub {
+subtest "Exor RDI download doesn't appear outside of Oxfordshire cobrand admin" => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ { 'fixmystreet' => '.' } ],
}, sub {
@@ -67,7 +73,168 @@ subtest 'Exor RDI download doesn’t appear outside of Oxfordshire cobrand admin
}
};
-# Clean up
-$mech->delete_user( $superuser );
-$mech->delete_problems_for_body( 2237 );
-done_testing();
+subtest 'Exor file looks okay' => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'oxfordshire' ],
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $mech->log_in_ok( $superuser->email );
+ $mech->get_ok('/admin/exordefects');
+ $mech->submit_form_ok( { with_fields => {
+ start_date => '05/05/2017',
+ end_date => '05/05/2017',
+ user_id => $inspector->id,
+ } }, 'submit download');
+ $mech->content_contains("No inspections by that inspector in the selected date range");
+
+ my $dt = FixMyStreet::DB->resultset('DefectType')->create({
+ body => $oxon,
+ name => 'Footpath',
+ description => 'Footpath stuff',
+ });
+ $dt->set_extra_metadata(activity_code => 'FC');
+ $dt->set_extra_metadata(defect_code => 'SFP1');
+ $dt->update;
+ my $dt2 = FixMyStreet::DB->resultset('DefectType')->create({
+ body => $oxon,
+ name => 'Accidental sign damage',
+ description => 'Accidental sign damage',
+ });
+ $dt2->set_extra_metadata(activity_code => 'S');
+ $dt2->set_extra_metadata(defect_code => 'ACC2');
+ $dt2->update;
+ my $i = 123;
+ foreach my $problem (@problems) {
+ $problem->update({ state => 'action scheduled', external_id => $i });
+ $problem->update({ defect_type => $dt }) if $i == 123;
+ $problem->update({ defect_type => $dt2 }) if $i == 124;
+ FixMyStreet::DB->resultset('AdminLog')->create({
+ admin_user => $inspector->name,
+ user => $inspector,
+ object_type => 'problem',
+ action => 'inspected',
+ object_id => $problem->id,
+ whenedited => DateTime->new(year => 2017, month => 5, day => 5, hour => 12),
+ });
+ $i++;
+ }
+ $mech->submit_form_ok( { with_fields => {
+ start_date => '05/05/2017',
+ end_date => '05/05/2017',
+ user_id => $inspector->id,
+ } }, 'submit download');
+ (my $rdi = $mech->content) =~ s/\r\n/\n/g;
+ $rdi =~ s/(I,[FMS]C?,,)\d+/$1XXX/g; # Remove unique ID figures, unknown order
+ is $rdi, <<EOF, "RDI file matches expected";
+"1,1.8,1.0.0.0,ENHN,"
+"G,1989169,,,XX,170505,1600,D,INS,N,,,,"
+"H,FC"
+"I,FC,,XXX,"434970E 209683N Nearest postcode: OX28 4DS.",1200,,,,,,,,"TM none","123 ""
+"J,SFP1,2,,,434970,209683,,,,,"
+"M,resolve,,,/CFC,,"
+"P,0,999999"
+"G,1989169,,,XX,170505,1600,D,INS,N,,,,"
+"H,MC"
+"I,MC,,XXX,"434970E 209683N Nearest postcode: OX28 4DS.",1200,,,,,,,,"TM none","125 ""
+"J,SFP2,2,,,434970,209683,,,,,"
+"M,resolve,,,/CMC,,"
+"P,0,999999"
+"G,1989169,,,XX,170505,1600,D,INS,N,,,,"
+"H,S"
+"I,S,,XXX,"434970E 209683N Nearest postcode: OX28 4DS.",1200,,,,,,,,"TM none","124 ""
+"J,ACC2,2,,,434970,209683,,,,,"
+"M,resolve,,,/CSI,,"
+"P,0,999999"
+"X,3,3,3,3,0,0,0,3,0,3,0,0,0"
+EOF
+ foreach my $problem (@problems) {
+ $problem->discard_changes;
+ is $problem->get_extra_metadata('rdi_processed'), undef, "Problem was not logged as sent in RDI";
+ }
+
+ }
+};
+
+subtest 'Reports are marked as inspected correctly' => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'oxfordshire' ],
+ }, sub {
+ my $date = DateTime->new(year => 2017, month => 5, day => 5, hour => 12);
+
+ my $now = DateTime->now(
+ time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone
+ );
+ my $datetime = Test::MockModule->new('DateTime');
+ $datetime->mock('now', sub { $now });
+
+ my $params = {
+ start_date => $date,
+ end_date => $date,
+ inspection_date => $date,
+ user => $inspector,
+ mark_as_processed => 1,
+ };
+ my $rdi = FixMyStreet::Integrations::ExorRDI->new($params);
+ $rdi->construct;
+
+ foreach my $problem (@problems) {
+ $problem->discard_changes;
+ is $problem->get_extra_metadata('rdi_processed'), $now->strftime( '%Y-%m-%d %H:%M' ), "Problem was logged as sent in RDI";
+ }
+ };
+};
+
+subtest 'response times messages displayed' => sub {
+ my $oxfordshire = $mech->create_body_ok(
+ 2237, 'Oxfordshire County Council'
+ );
+ my $contact = $mech->create_contact_ok(
+ body_id => $oxfordshire->id,
+ category => 'Pothole',
+ email => 'pothole@example.com',
+ );
+
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'oxfordshire' ],
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ $mech->log_out_ok;
+ $mech->clear_emails_ok;
+
+ $mech->get_ok('/around');
+ $mech->submit_form_ok( {
+ with_fields => { pc => 'OX20 1SZ' }
+ },
+ "submit_location"
+ );
+
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link" );
+
+ $mech->submit_form_ok(
+ {
+ with_fields => {
+ title => 'Test Report',
+ detail => 'Test report details.',
+ photo1 => '',
+ email => 'test-2@example.com',
+ name => 'Test User',
+ category => 'Pothole',
+ }
+ },
+ "submit details"
+ );
+
+ $mech->text_contains('Problems in the Pothole category are generally responded');
+ my $email = $mech->get_email;
+ ok $email, 'got and email';
+ like $mech->get_text_body_from_email, qr/Problems in the Pothole category/, 'emails contains response time message';
+ my $url = $mech->get_link_from_email($email);
+ $mech->get_ok($url);
+ $mech->text_contains('Problems in the Pothole category are generally responded')
+ };
+};
+
+END {
+ done_testing();
+}
diff --git a/t/cobrand/restriction.t b/t/cobrand/restriction.t
index 873a396b7..9e3018625 100644
--- a/t/cobrand/restriction.t
+++ b/t/cobrand/restriction.t
@@ -17,7 +17,6 @@ sub updates_restriction {
package main;
-use Test::More;
use FixMyStreet::TestMech;
my $c = FixMyStreet::App->new;
@@ -51,5 +50,4 @@ is($cobrand->updates->count, 1, 'One update in the right cobrand');
my $nearby = $c->model('DB::Nearby')->nearby($c, 5, [], 10, 0.003, 0.004);
is(@$nearby, 1, 'One report close to the origin point');
-$mech->delete_problems_for_body(1234);
done_testing();
diff --git a/t/cobrand/two_tier.t b/t/cobrand/two_tier.t
index 97bbccc01..c8a16ea9a 100644
--- a/t/cobrand/two_tier.t
+++ b/t/cobrand/two_tier.t
@@ -1,8 +1,4 @@
-use strict;
-use warnings;
-use Test::More;
-
-use FixMyStreet;
+use FixMyStreet::Test;
use FixMyStreet::Cobrand;
my @cobrands = (
@@ -19,8 +15,8 @@ FixMyStreet::override_config {
for my $c (@cobrands) {
my ($m, $id) = @$c;
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($m);
- my $council_id = $cobrand->council_id;
- is $council_id, $id, "council_id for $m";
+ my $council_area_id = $cobrand->council_area_id;
+ is $council_area_id, $id, "council_area_id for $m";
}
};
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index 0a84d2d03..03b20b087 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -1,15 +1,14 @@
# TODO
# Overdue alerts
-use strict;
-use warnings;
use DateTime;
use Email::MIME;
use LWP::Protocol::PSGI;
-use Test::More;
use Test::LongString;
use Path::Tiny;
use t::Mock::MapItZurich;
+use FixMyStreet::TestMech;
+my $mech = FixMyStreet::TestMech->new;
# Check that you have the required locale installed - the following
# should return a line with de_CH.utf8 in. If not install that locale.
@@ -53,9 +52,6 @@ sub reset_report_state {
$report->update;
}
-use FixMyStreet::TestMech;
-my $mech = FixMyStreet::TestMech->new;
-
# Front page test
ok $mech->host("zurich.example.com"), "change host to Zurich";
FixMyStreet::override_config {
@@ -699,6 +695,7 @@ subtest "only superuser can edit bodies" => sub {
$user = $mech->log_in_ok( 'dm1@example.org' );
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'zurich' ],
+ MAPIT_URL => 'http://mapit.zurich/',
}, sub {
$mech->get( '/admin/body/' . $zurich->id );
};
@@ -707,7 +704,6 @@ subtest "only superuser can edit bodies" => sub {
};
subtest "only superuser can see 'Add body' form" => sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
$user = $mech->log_in_ok( 'dm1@example.org' );
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'zurich' ],
@@ -722,7 +718,6 @@ subtest "only superuser can see 'Add body' form" => sub {
};
subtest "phone number is mandatory" => sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
FixMyStreet::override_config {
MAPIT_TYPES => [ 'O08' ],
MAPIT_URL => 'http://mapit.zurich/',
@@ -739,7 +734,6 @@ subtest "phone number is mandatory" => sub {
};
subtest "phone number is not mandatory for reports from mobile apps" => sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
FixMyStreet::override_config {
MAPIT_TYPES => [ 'O08' ],
MAPIT_URL => 'http://mapit.zurich/',
@@ -766,7 +760,6 @@ subtest "phone number is not mandatory for reports from mobile apps" => sub {
};
subtest "problems can't be assigned to deleted bodies" => sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
$user = $mech->log_in_ok( 'dm1@example.org' );
$user->from_body( $zurich->id );
$user->update;
@@ -795,13 +788,11 @@ subtest "problems can't be assigned to deleted bodies" => sub {
};
subtest "photo must be supplied for categories that require it" => sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
FixMyStreet::App->model('DB::Contact')->find_or_create({
body => $division,
category => "Graffiti - photo required",
email => "graffiti\@example.org",
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => "editor",
whenedited => DateTime->now(),
note => "note for graffiti",
@@ -974,20 +965,21 @@ FixMyStreet::override_config {
MAPIT_URL => 'http://mapit.zurich/',
MAPIT_TYPES => [ 'ZZZ' ],
}, sub {
- LWP::Protocol::PSGI->register(t::Mock::MapItZurich->run_if_script, host => 'mapit.zurich');
subtest 'users at the top level can be edited' => sub {
$mech->log_in_ok( $superuser->email );
$mech->get_ok('/admin/user_edit/' . $superuser->id );
};
};
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'zurich' ],
+}, sub {
+ subtest 'A visit to /reports is okay' => sub {
+ $mech->get_ok('/reports');
+ };
+};
+
END {
- $mech->delete_body($subdivision);
- $mech->delete_body($division);
- $mech->delete_body($zurich);
- $mech->delete_body($external_body);
- $mech->delete_user( 'dm1@example.org' );
- $mech->delete_user( 'sdm1@example.org' );
ok $mech->host("www.fixmystreet.com"), "change host back";
done_testing();
}