aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-10-20 17:02:09 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-10-20 17:02:09 +0100
commit8e5853830f0fb65985881272b3b0178b37ac947b (patch)
tree3be466a2381a89c819002f91f350f341bdd14554 /t/cobrand
parent235502e48f2a94ac90c425a04cda09cb22ad78d2 (diff)
parent6e1d005093e6a97f2f8bd90def4aa794b2ca7cc3 (diff)
Merge branch 'reports-dashboard-councils'
Diffstat (limited to 't/cobrand')
-rw-r--r--t/cobrand/fixmystreet.t47
1 files changed, 47 insertions, 0 deletions
diff --git a/t/cobrand/fixmystreet.t b/t/cobrand/fixmystreet.t
new file mode 100644
index 000000000..eda93e187
--- /dev/null
+++ b/t/cobrand/fixmystreet.t
@@ -0,0 +1,47 @@
+use FixMyStreet::Script::UpdateAllReports;
+
+use FixMyStreet::TestMech;
+my $mech = FixMyStreet::TestMech->new;
+
+my $body = $mech->create_body_ok( 2514, 'Birmingham' );
+
+my $data;
+FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.uk/',
+}, sub {
+ $data = FixMyStreet::Script::UpdateAllReports::generate_dashboard($body);
+};
+
+FixMyStreet::override_config {
+ MAPIT_URL => 'http://mapit.uk/',
+ TEST_DASHBOARD_DATA => $data,
+ ALLOWED_COBRANDS => 'fixmystreet',
+}, sub {
+ # Not logged in, redirected
+ $mech->get_ok('/reports/Birmingham/summary');
+ is $mech->uri->path, '/about/council-dashboard';
+
+ $mech->submit_form_ok({ with_fields => { username => 'someone@somewhere.example.org' }});
+ $mech->content_contains('We will be in touch');
+ # XXX Check email arrives
+
+ $mech->log_in_ok('someone@somewhere.example.org');
+ $mech->get_ok('/reports/Birmingham/summary');
+ is $mech->uri->path, '/about/council-dashboard';
+ $mech->content_contains('Ending in .gov.uk');
+
+ $mech->submit_form_ok({ with_fields => { name => 'Someone', username => 'someone@birmingham.gov.uk' }});
+ $mech->content_contains('Now check your email');
+ # XXX Check email arrives, click link
+
+ $mech->log_in_ok('someone@birmingham.gov.uk');
+ # Logged in, redirects
+ $mech->get_ok('/about/council-dashboard');
+ is $mech->uri->path, '/reports/Birmingham/summary';
+ $mech->content_contains('Top 5 wards');
+
+};
+
+END {
+ done_testing();
+}