From 61749f6f561c18b8eef9d5b5158a7a1505ba1c4a Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 25 May 2017 09:07:34 +0100 Subject: Fix test that would not run offline. Switch it to use our mock MapIt. Also remove other unused overrides to external services. --- t/app/model/problem.t | 3 --- 1 file changed, 3 deletions(-) (limited to 't/app/model/problem.t') diff --git a/t/app/model/problem.t b/t/app/model/problem.t index 6b1be0a76..47f654236 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -531,7 +531,6 @@ foreach my $test ( { my $override = { ALLOWED_COBRANDS => [ 'fixmystreet' ], BASE_URL => 'http://www.fixmystreet.com', - MAPIT_URL => 'http://mapit.mysociety.org/', }; if ( $test->{cobrand} && $test->{cobrand} =~ /hart/ ) { $override->{ALLOWED_COBRANDS} = [ 'hart' ]; @@ -607,8 +606,6 @@ foreach my $test ( { subtest 'check can set mutiple emails as a single contact' => sub { my $override = { ALLOWED_COBRANDS => [ 'fixmystreet' ], - BASE_URL => 'http://www.fixmystreet.com', - MAPIT_URL => 'http://mapit.mysociety.org/', }; my $contact = { -- cgit v1.2.3 From 1bb94cd0bf0821927b3f449d832a9982b0397fa9 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 31 May 2017 12:48:17 +0100 Subject: Auto-add strict/warnings/Test::More with TestMech. --- t/app/model/problem.t | 5 ----- 1 file changed, 5 deletions(-) (limited to 't/app/model/problem.t') diff --git a/t/app/model/problem.t b/t/app/model/problem.t index 47f654236..d95aec98d 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -1,8 +1,3 @@ -use strict; -use warnings; - -use Test::More; - use FixMyStreet::TestMech; use FixMyStreet; use FixMyStreet::App; -- cgit v1.2.3 From 3b72526db1cdb4695f61a188261351ddd2aea395 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 14 Jun 2017 13:59:43 +0100 Subject: Run each test file in a transaction. This means that the tests can be run in parallel. --- t/app/model/problem.t | 6 ------ 1 file changed, 6 deletions(-) (limited to 't/app/model/problem.t') diff --git a/t/app/model/problem.t b/t/app/model/problem.t index d95aec98d..142262ae9 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -875,11 +875,5 @@ subtest 'return how many days ago a problem was reported' => sub { }; END { - $problem->comments->delete if $problem; - $problem->delete if $problem; - $mech->delete_user( $user ) if $user; - - $mech->delete_body($_) for @bodies; - done_testing(); } -- cgit v1.2.3 From 466c5cac0f000bfa80ab49c88ec6e03c388ac328 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Sat, 8 Jul 2017 22:11:57 +0100 Subject: Add inactive state to categories. A new 'state' column replaces confirmed and deleted, allowing categories to be unconfirmed, confirmed, deleted or inactive. --- t/app/model/problem.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/app/model/problem.t') diff --git a/t/app/model/problem.t b/t/app/model/problem.t index 142262ae9..76b7c476a 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -425,7 +425,7 @@ for my $contact ( { category => 'Graffiti', email => 'highways@example.net', }, { - confirmed => 0, + state => 'unconfirmed', body_id => $body_ids{2636}, # Isle of Wight category => 'potholes', email => '2636@example.com', -- cgit v1.2.3 From cc3e99fa9878bfb722e61d4a09d94839b152c5b7 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Sun, 16 Jul 2017 22:05:52 +0100 Subject: Set up translatable category columns. As category is used both for display and as a link between Problem and Contact tables, add `category_display` for use whenever a category is displayed. --- t/app/model/problem.t | 9 --------- 1 file changed, 9 deletions(-) (limited to 't/app/model/problem.t') diff --git a/t/app/model/problem.t b/t/app/model/problem.t index 76b7c476a..718b980b0 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -116,15 +116,6 @@ for my $test ( category => 'Please choose a category', } }, - { - desc => 'bad category', - changed => { - category => '-- Pick a property type --', - }, - errors => { - category => 'Please choose a property type', - } - }, { desc => 'correct category', changed => { -- cgit v1.2.3 From 1bdef6cf43c1c6bd8f58a2533468db09b098213c Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 15 Aug 2017 17:35:53 +0100 Subject: Store duplicate reverse lookups upon dupe setting. This avoids the need to search the whole table to find a report's duplicates. And is easier than constructing an index or upgrading PostgreSQL. --- t/app/model/problem.t | 2 ++ 1 file changed, 2 insertions(+) (limited to 't/app/model/problem.t') diff --git a/t/app/model/problem.t b/t/app/model/problem.t index 718b980b0..b0719d6a6 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -776,6 +776,8 @@ subtest 'check duplicate reports' => sub { $problem1->set_extra_metadata(duplicate_of => $problem2->id); $problem1->state('duplicate'); $problem1->update; + $problem2->set_extra_metadata(duplicates => [ $problem1->id ]); + $problem2->update; is $problem1->duplicate_of->title, $problem2->title, 'problem1 returns correct problem from duplicate_of'; is scalar @{ $problem2->duplicates }, 1, 'problem2 has correct number of duplicates'; -- cgit v1.2.3 From a51c4dff85fa403978a313b4330081fd3ca9993c Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 25 Aug 2017 12:44:30 +0100 Subject: Make sure gettext domain specified in all tests. --- t/app/model/problem.t | 3 --- 1 file changed, 3 deletions(-) (limited to 't/app/model/problem.t') diff --git a/t/app/model/problem.t b/t/app/model/problem.t index b0719d6a6..efc9057da 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -2,11 +2,8 @@ use FixMyStreet::TestMech; use FixMyStreet; use FixMyStreet::App; use FixMyStreet::DB; -use mySociety::Locale; use Sub::Override; -mySociety::Locale::gettext_domain('FixMyStreet'); - my $problem_rs = FixMyStreet::DB->resultset('Problem'); my $problem = $problem_rs->new( -- cgit v1.2.3