aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/about.t18
-rw-r--r--t/app/controller/admin.t10
-rw-r--r--t/app/controller/questionnaire.t25
-rw-r--r--t/app/controller/report_interest_count.t24
-rw-r--r--t/app/controller/reports.t11
-rw-r--r--t/app/model/user.t2
-rw-r--r--t/app/uri_for.t26
7 files changed, 33 insertions, 83 deletions
diff --git a/t/app/controller/about.t b/t/app/controller/about.t
index 6a082a2ff..cec50abfa 100644
--- a/t/app/controller/about.t
+++ b/t/app/controller/about.t
@@ -1,3 +1,4 @@
+use utf8;
use strict;
use warnings;
@@ -21,19 +22,12 @@ ok !$mech->res->is_success(), "want a bad response";
is $mech->res->code, 404, "got 404";
FixMyStreet::override_config {
- ALLOWED_COBRANDS => [ 'emptyhomes' ],
+ ALLOWED_COBRANDS => [ 'fiksgatami' ],
}, sub {
- # check that geting the page as EHA produces a different page
- ok $mech->host("reportemptyhomes.co.uk"), 'change host to reportemptyhomes';
- $mech->get_ok('/about');
- $mech->content_like(qr{About us ::});
- $mech->content_contains('html lang="en-gb"');
-
- # check that geting the page as EHA in welsh produces a different page
- ok $mech->host("cy.reportemptyhomes.co.uk"), 'host to cy.reportemptyhomes';
- $mech->get_ok('/about');
- $mech->content_like(qr{Amdanom ni ::});
- $mech->content_contains('html lang="cy"');
+ ok $mech->host("www.fiksgatami.no"), 'host to fiksgatami';
+ $mech->get_ok('/faq');
+ $mech->content_like(qr{Ofte spurte spørsmål ::});
+ $mech->content_contains('html class="no-js" lang="nb"');
};
done_testing();
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 310e0a677..1dcb768dc 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -104,9 +104,9 @@ subtest 'check summary counts' => sub {
$mech->content_contains( "$q_count questionnaires sent" );
FixMyStreet::override_config {
- ALLOWED_COBRANDS => [ 'barnet' ],
+ ALLOWED_COBRANDS => [ 'oxfordshire' ],
}, sub {
- ok $mech->host('barnet.fixmystreet.com');
+ ok $mech->host('oxfordshire.fixmystreet.com');
$mech->get_ok('/admin');
$mech->title_like(qr/Summary/);
@@ -115,11 +115,11 @@ subtest 'check summary counts' => sub {
my ($num_alerts) = $mech->content =~ /(\d+) confirmed alerts/;
my ($num_qs) = $mech->content =~ /(\d+) questionnaires sent/;
- $report->bodies_str(2489);
- $report->cobrand('barnet');
+ $report->bodies_str(2237);
+ $report->cobrand('oxfordshire');
$report->update;
- $alert->cobrand('barnet');
+ $alert->cobrand('oxfordshire');
$alert->update;
$mech->get_ok('/admin');
diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t
index cad86a40d..7bc6545db 100644
--- a/t/app/controller/questionnaire.t
+++ b/t/app/controller/questionnaire.t
@@ -394,31 +394,23 @@ for my $test (
}
FixMyStreet::override_config {
- ALLOWED_COBRANDS => [ 'emptyhomes', 'fixmystreet' ],
+ ALLOWED_COBRANDS => [ 'fixmystreet' ],
}, sub {
- # EHA extra checking
- ok $mech->host("reportemptyhomes.com"), 'change host to reportemptyhomes';
-
- # Reset, and all the questionaire sending function - FIXME should it detect site itself somehow?
+ $report->discard_changes;
$report->send_questionnaire( 1 );
$report->update;
$questionnaire->delete;
- FixMyStreet::App->model('DB::Questionnaire')->send_questionnaires( {
- site => 'emptyhomes'
- } );
+ FixMyStreet::App->model('DB::Questionnaire')->send_questionnaires();
$email = $mech->get_email;
ok $email, "got an email";
$mech->clear_emails_ok;
(my $body = $email->body) =~ s/\s+/ /g;
- like $body, qr/fill in this short questionnaire/i, "got questionnaire email";
+ like $body, qr/fill in our short questionnaire/i, "got questionnaire email";
($token) = $email->body =~ m{http://.*?/Q/(\S+)};
ok $token, "extracted questionnaire token '$token'";
- $mech->get_ok("/Q/" . $token);
- $mech->content_lacks( 'Would you like to receive another questionnaire' );
-
# Test already answered the ever reported question, so not shown again
$dt = $dt->add( weeks => 4 );
my $questionnaire2 = FixMyStreet::App->model('DB::Questionnaire')->find_or_create(
@@ -429,17 +421,11 @@ FixMyStreet::override_config {
}
);
ok $questionnaire2, 'added another questionnaire';
- ok $mech->host("www.fixmystreet.com"), 'change host to fixmystreet';
$mech->get_ok("/Q/" . $token);
$mech->title_like( qr/Questionnaire/ );
$mech->content_contains( 'Has this problem been fixed?' );
$mech->content_lacks( 'ever reported' );
- # EHA extra checking
- ok $mech->host("reportemptyhomes.com"), 'change host to reportemptyhomes';
- $mech->get_ok("/Q/" . $token);
- $mech->content_lacks( 'Would you like to receive another questionnaire' );
-
$token = FixMyStreet::App->model("DB::Token")->find( { scope => 'questionnaire', token => $token } );
ok $token, 'found token for questionnaire';
$questionnaire = FixMyStreet::App->model('DB::Questionnaire')->find( { id => $token->data } );
@@ -452,11 +438,12 @@ FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'fiksgatami' ],
}, sub {
# I18N Unicode extra testing using FiksGataMi
+ $report->discard_changes;
$report->send_questionnaire( 1 );
$report->cobrand( 'fiksgatami' );
$report->update;
$questionnaire->delete;
- FixMyStreet::App->model('DB::Questionnaire')->send_questionnaires( { site => 'fixmystreet' } ); # It's either fixmystreet or emptyhomes
+ FixMyStreet::App->model('DB::Questionnaire')->send_questionnaires();
$email = $mech->get_email;
ok $email, "got an email";
$mech->clear_emails_ok;
diff --git a/t/app/controller/report_interest_count.t b/t/app/controller/report_interest_count.t
index 506b50edd..4e86789ba 100644
--- a/t/app/controller/report_interest_count.t
+++ b/t/app/controller/report_interest_count.t
@@ -1,5 +1,16 @@
use strict;
use warnings;
+
+package FixMyStreet::Cobrand::Tester;
+
+use parent 'FixMyStreet::Cobrand::Default';
+
+sub can_support_problems {
+ return 1;
+}
+
+package main;
+
use Test::More;
use FixMyStreet::TestMech;
@@ -52,7 +63,7 @@ my $report_id = $report->id;
ok $report, "created test report - $report_id";
FixMyStreet::override_config {
- ALLOWED_COBRANDS => [ 'fixmybarangay' ],
+ ALLOWED_COBRANDS => [ 'tester' ],
}, sub {
my $body = $mech->create_body_ok(2504, 'Westminster City Council');
@@ -76,7 +87,6 @@ FixMyStreet::override_config {
},
) {
subtest $test->{desc} => sub {
- ok $mech->host('fixmybarangay.com'), 'changed to fixmybarangay';
$mech->log_in_ok( $user->email );
$user->from_body( $test->{from_body} );
$user->update;
@@ -92,7 +102,7 @@ FixMyStreet::override_config {
$mech->content_contains('Add support');
$mech->submit_form_ok( { form_number => 1 } );
- is $mech->uri, "http://fixmybarangay.com/report/$report_id", 'add support redirects to report page';
+ is $mech->uri->path, "/report/$report_id", 'add support redirects to report page';
$mech->content_contains($test->{updated_support});
} else {
@@ -102,26 +112,22 @@ FixMyStreet::override_config {
}
subtest 'check non body user cannot increment support count' => sub {
- ok $mech->host('fixmybarangay.com'), 'changed to fixmybarangay';
-
ok $report->update({ interest_count => 1 }), 'updated interest count';
is $report->interest_count, 1, 'correct interest count';
$mech->get_ok("/report/$report_id");
$mech->content_contains( '1 supporter' );
- # This doesn't send cookie, so is logged out
+ $mech->log_out_ok( $user->email );
$mech->post_ok("/report/support", { id => $report_id } );
- is $mech->uri, "http://fixmybarangay.com/report/$report_id", 'add support redirects to report page';
+ is $mech->uri->path, "/report/$report_id", 'add support redirects to report page';
$mech->content_contains( '1 supporter' );
};
};
subtest 'check support details not shown if not enabled in cobrand' => sub {
- ok $mech->host('www.fixmystreet.com'), 'changed to fixmystreet';
-
$report->interest_count(1);
ok $report->update, 'updated interest count';
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t
index 9b446174d..8869adaa7 100644
--- a/t/app/controller/reports.t
+++ b/t/app/controller/reports.t
@@ -196,17 +196,6 @@ $mech->get_ok('/reports');
$stats = $mech->extract_report_stats;
is $stats->{'Westminster City Council'}->[1], 5, 'non public reports included in stats';
-subtest "test emptyhomes all reports page" => sub {
- FixMyStreet::override_config {
- ALLOWED_COBRANDS => [ 'emptyhomes' ],
- }, sub {
- ok $mech->host("reportemptyhomes.com"), 'change host to reportemptyhomes';
- $mech->get_ok('/reports');
- # EHA lacks one column the others have
- $mech->content_lacks('state unknown');
- };
-};
-
subtest "test fiksgatami all reports page" => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'fiksgatami' ],
diff --git a/t/app/model/user.t b/t/app/model/user.t
index 24e5d2d98..bf73a9d09 100644
--- a/t/app/model/user.t
+++ b/t/app/model/user.t
@@ -46,7 +46,7 @@ END {
sub create_update {
my ($problem, %params) = @_;
- my $dt = DateTime->now()->add(hours => 1);
+ my $dt = DateTime->now()->add(days => 1);
return FixMyStreet::App->model('DB::Comment')->find_or_create({
problem_id => $problem->id,
user_id => $problem->user_id,
diff --git a/t/app/uri_for.t b/t/app/uri_for.t
index 810aade62..9cbcd3767 100644
--- a/t/app/uri_for.t
+++ b/t/app/uri_for.t
@@ -17,7 +17,6 @@ use_ok('FixMyStreet::App');
my $fms_c = ctx_request('http://www.fixmystreet.com/');
my $fgm_c = ctx_request('http://www.fiksgatami.no/');
-my $reh_en_c = ctx_request('http://reportemptyhomes.com/');
is(
$fms_c->uri_for('/bar/baz') . "",
@@ -44,29 +43,4 @@ is(
'FiksGataMi url with lat not zoom'
);
-FixMyStreet::override_config {
- ALLOWED_COBRANDS => [ 'emptyhomes' ],
-}, sub {
- like(
- $reh_en_c->uri_for_email( '/foo' ),
- qr{^http://en.},
- 'adds en to retain language'
- );
-};
-
-# instantiate this here otherwise sets locale to cy and breaks test
-# above
-my $reh_cy_c;
-FixMyStreet::override_config {
- ALLOWED_COBRANDS => [ 'emptyhomes' ],
-}, sub {
- $reh_cy_c = ctx_request('http://cy.reportemptyhomes.com/');
-
- like(
- $reh_cy_c->uri_for_email( '/foo' ),
- qr{^http://cy.},
- 'retains language'
- );
-};
-
done_testing();