aboutsummaryrefslogtreecommitdiffstats
path: root/t/open311.t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-08-19 10:39:19 +0100
committerStruan Donald <struan@exo.org.uk>2013-08-19 10:39:19 +0100
commitb3e8d609afe46e07b2ef8441f54a6f2f8255e250 (patch)
treed948cc00f030f144fe79102a0bb8c06c5d3b32fb /t/open311.t
parentbceda8f05abe5b21d42100f4de739aa6dc03c4cd (diff)
Open311 should user name from report not user
Open311 was using the name in the user table for it's reports when it should be the one in the problem table.
Diffstat (limited to 't/open311.t')
-rw-r--r--t/open311.t27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/open311.t b/t/open311.t
index 6795b929c..48a122296 100644
--- a/t/open311.t
+++ b/t/open311.t
@@ -38,6 +38,7 @@ my $p = FixMyStreet::App->model('DB::Problem')->new( {
detail => 'detail',
user => $u,
id => 1,
+ name => 'A User',
} );
my $expected_error = qr{Failed to submit problem 1 over Open311}ism;
@@ -61,6 +62,7 @@ my $problem = FixMyStreet::App->model('DB::Problem')->new( {
latitude => 1,
longitude => 2,
user => $user,
+ name => 'Test User',
} );
subtest 'posting service request' => sub {
@@ -186,6 +188,31 @@ for my $test (
};
}
+for my $test (
+ {
+ title => 'Check uses report name over user name',
+ name => 'Nom de Report',
+ first_name => 'Nom',
+ last_name => 'de Report',
+ },
+) {
+ subtest $test->{desc} => sub {
+ $problem->extra( undef );
+ $problem->name( $test->{name} );
+ my $extra = { url => 'http://example.com/report/1', };
+
+ my $results = make_service_req( $problem, $extra, $problem->category,
+'<?xml version="1.0" encoding="utf-8"?><service_requests><request><service_request_id>248</service_request_id></request></service_requests>'
+ );
+ my $req = $o->test_req_used;
+ my $c = CGI::Simple->new( $results->{req}->content );
+
+ is $c->param( 'first_name' ), $test->{first_name}, 'correct first name';
+ is $c->param( 'last_name' ), $test->{last_name}, 'correct last name';
+ };
+}
+
+
my $comment = FixMyStreet::App->model('DB::Comment')->new( {
id => 38362,
user => $user,