aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/waste.t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-06-29 15:00:55 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-11-11 10:28:23 +0000
commitce1b3ec61fdaa954c26e55b8ce8cd1ad619b3538 (patch)
tree3ab20e43f6bf6b4a0ca1284c019a26f5fe7a2ef5 /t/app/controller/waste.t
parent9292866fbc1be364a716ac9efb105a0350a2de72 (diff)
[Bromley] Add waste service lookup.
This creates an integration to view bin collection days, and placeholders for the start of a non-map property-based reporting flow.
Diffstat (limited to 't/app/controller/waste.t')
-rw-r--r--t/app/controller/waste.t53
1 files changed, 53 insertions, 0 deletions
diff --git a/t/app/controller/waste.t b/t/app/controller/waste.t
new file mode 100644
index 000000000..77b1ef5bc
--- /dev/null
+++ b/t/app/controller/waste.t
@@ -0,0 +1,53 @@
+use Test::MockModule;
+use FixMyStreet::TestMech;
+
+my $mech = FixMyStreet::TestMech->new;
+
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => ['bromley', 'fixmystreet'],
+ COBRAND_FEATURES => { echo => { bromley => { sample_data => 1 } }, waste => { bromley => 1 } },
+}, sub {
+ $mech->host('bromley.fixmystreet.com');
+ subtest 'Missing address lookup' => sub {
+ $mech->get_ok('/waste');
+ $mech->submit_form_ok({ with_fields => { postcode => 'BR1 1AA' } });
+ $mech->submit_form_ok({ with_fields => { address => 'missing' } });
+ $mech->content_contains('can’t find your address');
+ };
+ subtest 'Address lookup' => sub {
+ $mech->get_ok('/waste');
+ $mech->submit_form_ok({ with_fields => { postcode => 'BR1 1AA' } });
+ $mech->submit_form_ok({ with_fields => { address => '1000000002' } });
+ $mech->content_contains('2 Example Street');
+ $mech->content_contains('Food Waste');
+ };
+};
+
+package SOAP::Result;
+sub result { return $_[0]->{result}; }
+sub new { my $c = shift; bless { @_ }, $c; }
+
+package main;
+
+FixMyStreet::override_config {
+ ALLOWED_COBRANDS => 'bromley',
+ COBRAND_FEATURES => { echo => { bromley => { url => 'http://example.org' } }, waste => { bromley => 1 } },
+}, sub {
+ subtest 'Address lookup, mocking SOAP call' => sub {
+ my $integ = Test::MockModule->new('SOAP::Lite');
+ $integ->mock(call => sub {
+ return SOAP::Result->new(result => {
+ PointInfo => [
+ { Description => '1 Example Street', SharedRef => { Value => { anyType => 1000000001 } } },
+ { Description => '2 Example Street', SharedRef => { Value => { anyType => 1000000002 } } },
+ ],
+ });
+ });
+
+ $mech->get_ok('/waste');
+ $mech->submit_form_ok({ with_fields => { postcode => 'BR1 1AA' } });
+ $mech->content_contains('2 Example Street');
+ };
+};
+
+done_testing;