aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/report_import.t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-08-18 22:56:00 +0100
committerStruan Donald <struan@exo.org.uk>2011-08-18 22:56:00 +0100
commitfbf99125eb1a5544dd231d3cd55a1fcfb4cb2ae6 (patch)
tree398ac310db4d81ba0ec63a104b2c199f6949705c /t/app/controller/report_import.t
parent66657b4d1a4aa002609c2435a9a7686cd3257cdc (diff)
use correct skip
Diffstat (limited to 't/app/controller/report_import.t')
-rw-r--r--t/app/controller/report_import.t122
1 files changed, 62 insertions, 60 deletions
diff --git a/t/app/controller/report_import.t b/t/app/controller/report_import.t
index 385445565..d6bff240c 100644
--- a/t/app/controller/report_import.t
+++ b/t/app/controller/report_import.t
@@ -264,69 +264,71 @@ subtest "Submit a correct entry (with location)" => sub {
subtest "Submit a correct entry (with location) to cobrand" => sub {
- skip( "Need 'fiksgatami' in ALLOWED_COBRANDS config", 8 )
- unless FixMyStreet::App->config->{ALLOWED_COBRANDS} =~ m{fiksgatami};
- mySociety::MaPit::configure('http://mapit.nuug.no/');
- ok $mech->host("fiksgatami.no"), 'change host to fiksgatami';
+ SKIP: {
+ skip( "Need 'fiksgatami' in ALLOWED_COBRANDS config", 20 )
+ unless FixMyStreet::App->config->{ALLOWED_COBRANDS} =~ m{fiksgatami};
+ mySociety::MaPit::configure('http://mapit.nuug.no/');
+ ok $mech->host("fiksgatami.no"), 'change host to fiksgatami';
- $mech->get_ok('/import');
-
- $mech->submit_form_ok( #
- {
- with_fields => {
- service => 'test-script',
- lat => '59',
- lon => '10',
- name => 'Test User ll',
- email => 'test-ll@example.com',
- subject => 'Test report ll',
- detail => 'This is a test report ll',
- photo => $sample_file,
- }
- },
- "fill in form"
- );
-
- is_deeply( $mech->import_errors, [], "got no errors" );
- is $mech->content, 'SUCCESS', "Got success response";
-
- # check that we have received the email
- $mech->email_count_is(1);
- my $email = $mech->get_email;
- $mech->clear_emails_ok;
-
- my ($token_url) = $email->body =~ m{(http://\S+)};
- ok $token_url, "Found a token url $token_url";
-
- # go to the token url
- $mech->get_ok($token_url);
-
- # check that we are on '/report/new'
- is $mech->uri->path, '/report/new', "sent to /report/new";
-
- # check that fields are prefilled for us
- is_deeply $mech->visible_form_values,
- {
- name => 'Test User ll',
- title => 'Test report ll',
- detail => 'This is a test report ll',
- photo => '',
- phone => '',
- may_show_name => '1',
- },
- "check imported fields are shown";
-
- my $user =
- FixMyStreet::App->model('DB::User')
- ->find( { email => 'test-ll@example.com' } );
- ok $user, "Found a user";
+ $mech->get_ok('/import');
- my $report = $user->problems->first;
- is $report->state, 'partial', 'is still partial';
- is $report->title, 'Test report ll', 'title is correct';
- is $report->lang, 'nb', 'language is correct';
+ $mech->submit_form_ok( #
+ {
+ with_fields => {
+ service => 'test-script',
+ lat => '59',
+ lon => '10',
+ name => 'Test User ll',
+ email => 'test-ll@example.com',
+ subject => 'Test report ll',
+ detail => 'This is a test report ll',
+ photo => $sample_file,
+ }
+ },
+ "fill in form"
+ );
- $mech->delete_user($user);
+ is_deeply( $mech->import_errors, [], "got no errors" );
+ is $mech->content, 'SUCCESS', "Got success response";
+
+ # check that we have received the email
+ $mech->email_count_is(1);
+ my $email = $mech->get_email;
+ $mech->clear_emails_ok;
+
+ my ($token_url) = $email->body =~ m{(http://\S+)};
+ ok $token_url, "Found a token url $token_url";
+
+ # go to the token url
+ $mech->get_ok($token_url);
+
+ # check that we are on '/report/new'
+ is $mech->uri->path, '/report/new', "sent to /report/new";
+
+ # check that fields are prefilled for us
+ is_deeply $mech->visible_form_values,
+ {
+ name => 'Test User ll',
+ title => 'Test report ll',
+ detail => 'This is a test report ll',
+ photo => '',
+ phone => '',
+ may_show_name => '1',
+ },
+ "check imported fields are shown";
+
+ my $user =
+ FixMyStreet::App->model('DB::User')
+ ->find( { email => 'test-ll@example.com' } );
+ ok $user, "Found a user";
+
+ my $report = $user->problems->first;
+ is $report->state, 'partial', 'is still partial';
+ is $report->title, 'Test report ll', 'title is correct';
+ is $report->lang, 'nb', 'language is correct';
+
+ $mech->delete_user($user);
+ }
};
done_testing();