diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-06-15 12:43:54 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-06-15 13:47:53 +0100 |
commit | 8d428f9c8fd9e25821560a20d00d444d9fb67e08 (patch) | |
tree | 52b75a1f922b589a151acccc0ee38c2ac9a90f59 /t/open311 | |
parent | 96c72fa72e547a2ce5b435db3cae8c3c45efafc1 (diff) |
Tidy up Open311 XML handling.
Parse the XML in such a way other parts of the code do not have to worry
about single-value folding or the like.
Diffstat (limited to 't/open311')
-rw-r--r-- | t/open311/getservicerequestupdates.t | 4 | ||||
-rw-r--r-- | t/open311/populate-service-list.t | 13 |
2 files changed, 3 insertions, 14 deletions
diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t index 134d5422e..e13a34492 100644 --- a/t/open311/getservicerequestupdates.t +++ b/t/open311/getservicerequestupdates.t @@ -52,13 +52,13 @@ for my $test ( desc => 'basic parsing - empty element', updated_datetime => '<updated_datetime />', res => { update_id => 638344, service_request_id => 1, - status => 'open', description => 'This is a note', updated_datetime => {} } , + status => 'open', description => 'This is a note', updated_datetime => undef } , }, { desc => 'basic parsing - element with no content', updated_datetime => '<updated_datetime></updated_datetime>', res => { update_id => 638344, service_request_id => 1, - status => 'open', description => 'This is a note', updated_datetime => {} } , + status => 'open', description => 'This is a note', updated_datetime => undef } , }, { desc => 'basic parsing - element with content', diff --git a/t/open311/populate-service-list.t b/t/open311/populate-service-list.t index f001926d2..606bcbc44 100644 --- a/t/open311/populate-service-list.t +++ b/t/open311/populate-service-list.t @@ -419,7 +419,6 @@ for my $test ( ); my $service_list = get_xml_simple_object( $services_xml ); - $service_list = { service => [ $service_list->{ service } ] }; $processor->_current_open311( $o ); $processor->_current_body( $body ); @@ -690,17 +689,7 @@ sub get_standard_xml { sub get_xml_simple_object { my $xml = shift; - - my $simple = XML::Simple->new(); - my $obj; - - eval { - $obj = $simple->XMLin( $xml ); - }; - - die $@ if $@; - - return $obj; + return Open311->_get_xml_object($xml); } done_testing(); |