aboutsummaryrefslogtreecommitdiffstats
path: root/t/open311.t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-08-22 10:57:10 +0100
committerStruan Donald <struan@exo.org.uk>2012-08-22 10:57:10 +0100
commit2e0a4e8ec45579e4e5c9cf8aa123d5ab215b9703 (patch)
treec13e3c59b686e01460dc7960547f7e9c53c288bd /t/open311.t
parentb99c5ff97b29a27eeba52ed24385ac30388e875c (diff)
parent88a7d38dffa3dabdf0f85573b254cea9c8ab232b (diff)
Merge remote-tracking branch 'origin/master' into fmb-read-only
Conflicts: .gitignore bin/make_css conf/general.yml-example perllib/FixMyStreet/App/Controller/Council.pm perllib/FixMyStreet/App/Controller/Report/New.pm perllib/FixMyStreet/Cobrand/Default.pm templates/web/default/around/around_index.html templates/web/default/index.html templates/web/emptyhomes/index.html templates/web/fixmystreet/around/around_index.html templates/web/fixmystreet/index.html web/fixmystreet_app_cgi.cgi web/fixmystreet_app_fastcgi.cgi
Diffstat (limited to 't/open311.t')
-rw-r--r--t/open311.t43
1 files changed, 43 insertions, 0 deletions
diff --git a/t/open311.t b/t/open311.t
index 814b11f82..f082179ea 100644
--- a/t/open311.t
+++ b/t/open311.t
@@ -428,6 +428,49 @@ subtest 'error reponse' => sub {
is $results->{ res }, 0, 'error in response is a failure';
};
+for my $test (
+ {
+ desc => 'deviceid not sent by default',
+ use_service_as_id => 0,
+ service => 'iPhone',
+ },
+ {
+ desc => 'if use_service_as_id set then deviceid sent with service as id',
+ use_service_as_id => 1,
+ service => 'iPhone',
+ },
+ {
+ desc => 'no deviceid sent if service is blank',
+ use_service_as_id => 1,
+ service => '',
+ },
+ )
+{
+ subtest $test->{desc} => sub {
+ my $extra = { url => 'http://example.com/report/1', };
+ $problem->service( $test->{service} );
+
+ 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>',
+ { use_service_as_deviceid => $test->{use_service_as_id} },
+ );
+
+ is $results->{res}, 248, 'got request id';
+
+ my $c = CGI::Simple->new( $results->{req}->content );
+
+ if ( $test->{use_service_as_id} and $test->{service} ) {
+ is $c->param('deviceid'), $test->{service}, 'deviceid set to service';
+ }
+ else {
+ is $c->param('deviceid'), undef, 'no deviceid is set';
+ }
+ };
+}
+
done_testing();
sub make_update_req {