Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pezholio committed Dec 18, 2014
1 parent af17c22 commit f268eae
Showing 1 changed file with 77 additions and 68 deletions.
145 changes: 77 additions & 68 deletions features/postcode_data.feature
@@ -1,10 +1,10 @@
@postcode
Feature: Accessing postcode data

As a user
I want to access postcode data
So I can use it in my application

Scenario: Access JSON version
Given I access the JSON version of "AB1 0AA"
Then I should see the following json:
Expand Down Expand Up @@ -76,26 +76,26 @@ Feature: Accessing postcode data
"code": "E04008932"
},
"electoral_district": {
"title": "Lichfield City South",
"uri": "http://data.ordnancesurvey.co.uk/id/7000000000042775",
"title": "Lichfield City South",
"uri": "http://data.ordnancesurvey.co.uk/id/7000000000042775",
"code": "7000000000042775"
}
}
}
"""

@enable_caching
Scenario: JSONP works correctly with caching
Given I access the JSONP version of "AB1 0AA" with the callback "J50Npi.success"
Then I should see the correct callback
And I access the JSONP version of "AB1 0AA" with the callback "J50Npi.success2"
Then I should see the correct callback

Scenario: JSON requests with callbacks get redirected to JSONP
Given I access the JSON version of "AB1 0AA" with the callback "J50Npi.success"
Then I should be redirected to the JSONP version of the data
And I should see the correct callback

Scenario: Access XML version
Given I access the XML version of "AB1 0AA"
Then I should see the following xml:
Expand Down Expand Up @@ -166,10 +166,10 @@ Feature: Accessing postcode data
<uri>http://statistics.data.gov.uk/id/statistical-geography/E04008932</uri>
<code>E04008932</code>
</parish>
<electoral_district>
<title>Lichfield City South</title>
<uri>http://data.ordnancesurvey.co.uk/id/7000000000042775</uri>
<code>7000000000042775</code>
<electoral_district>
<title>Lichfield City South</title>
<uri>http://data.ordnancesurvey.co.uk/id/7000000000042775</uri>
<code>7000000000042775</code>
</electoral_district>
</administrative>
</result>
Expand All @@ -179,78 +179,87 @@ Feature: Accessing postcode data
Given I access the RDF version of "AB1 0AA"
Then I should see the following rdf:
"""
<?xml version='1.0' encoding='utf-8' ?>
<rdf:RDF xmlns:geo='http://www.w3.org/2003/01/geo/wgs84_pos#' xmlns:ns0='http://data.ordnancesurvey.co.uk/ontology/postcode/' xmlns:osadmingeo='http://data.ordnancesurvey.co.uk/ontology/admingeo/' xmlns:owl='http://www.w3.org/2002/07/owl#' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#' xmlns:spatialrelations='http://data.ordnancesurvey.co.uk/ontology/spatialrelations/' xmlns:xsd='http://www.w3.org/2001/XMLSchema#'>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000030421'>
<rdfs:label>Aberdeen City</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000033487'>
<rdfs:label>Aberdeen South</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000043300'>
<rdfs:label>Lower Deeside</rdfs:label>
</rdf:Description>
<ns0:PostcodeUnit rdf:about='http://uk-postcodes.com/postcode/AB10AA'>
<rdfs:label>AB1 0AA</rdfs:label>
<osadmingeo:UnitaryAuthority rdf:resource='http://data.ordnancesurvey.co.uk/id/7000000000030421' />
<osadmingeo:UnitaryAuthorityWard rdf:resource='http://data.ordnancesurvey.co.uk/id/7000000000043300' />
<osadmingeo:WestminsterConstituency rdf:resource='http://data.ordnancesurvey.co.uk/id/7000000000033487' />
<spatialrelations:easting rdf:datatype='http://www.w3.org/2001/XMLSchema#integer'>385386</spatialrelations:easting>
<spatialrelations:northing rdf:datatype='http://www.w3.org/2001/XMLSchema#integer'>801193</spatialrelations:northing>
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/S12000033' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/S13002484' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/S14000002' />
<owl:sameAs rdf:resource='http://data.ordnancesurvey.co.uk/id/postcodeunit/AB10AA' />
<geo:lat rdf:datatype='http://www.w3.org/2001/XMLSchema#decimal'>57.10147801540051</geo:lat>
<geo:long rdf:datatype='http://www.w3.org/2001/XMLSchema#decimal'>-2.2428351220462</geo:long>
</ns0:PostcodeUnit>
</rdf:RDF>
<?xml version='1.0' encoding='utf-8' ?>
<rdf:RDF xmlns:geo='http://www.w3.org/2003/01/geo/wgs84_pos#' xmlns:ns0='http://data.ordnancesurvey.co.uk/ontology/postcode/' xmlns:osadmingeo='http://data.ordnancesurvey.co.uk/ontology/admingeo/' xmlns:owl='http://www.w3.org/2002/07/owl#' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#' xmlns:spatialrelations='http://data.ordnancesurvey.co.uk/ontology/spatialrelations/'>
<ns0:PostcodeUnit rdf:about='http://uk-postcodes.com/postcode/AB10AA'>
<rdfs:label>AB1 0AA</rdfs:label>
<osadmingeo:UnitaryAuthority>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000030421'>
<rdfs:label>Aberdeen City</rdfs:label>
</rdf:Description>
</osadmingeo:UnitaryAuthority>
<osadmingeo:UnitaryAuthorityWard>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000043300'>
<rdfs:label>Lower Deeside</rdfs:label>
</rdf:Description>
</osadmingeo:UnitaryAuthorityWard>
<osadmingeo:WestminsterConstituency>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000033487'>
<rdfs:label>Aberdeen South</rdfs:label>
</rdf:Description>
</osadmingeo:WestminsterConstituency>
<spatialrelations:easting rdf:datatype='http://www.w3.org/2001/XMLSchema#integer'>385386</spatialrelations:easting>
<spatialrelations:northing rdf:datatype='http://www.w3.org/2001/XMLSchema#integer'>801193</spatialrelations:northing>
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/S12000033' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/S13002484' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/S14000002' />
<owl:sameAs rdf:resource='http://data.ordnancesurvey.co.uk/id/postcodeunit/AB10AA' />
<geo:lat rdf:datatype='http://www.w3.org/2001/XMLSchema#decimal'>57.10147801540051</geo:lat>
<geo:long rdf:datatype='http://www.w3.org/2001/XMLSchema#decimal'>-2.2428351220462</geo:long>
</ns0:PostcodeUnit>
</rdf:RDF>
"""
And I access the RDF version of "WS14 9SQ"
Then I should see the following rdf:
"""
<?xml version='1.0' encoding='utf-8' ?>
<rdf:RDF xmlns:geo='http://www.w3.org/2003/01/geo/wgs84_pos#' xmlns:ns0='http://data.ordnancesurvey.co.uk/ontology/postcode/' xmlns:osadmingeo='http://data.ordnancesurvey.co.uk/ontology/admingeo/' xmlns:owl='http://www.w3.org/2002/07/owl#' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#' xmlns:spatialrelations='http://data.ordnancesurvey.co.uk/ontology/spatialrelations/' xmlns:xsd='http://www.w3.org/2001/XMLSchema#'>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000014792'>
<rdfs:label>Lichfield CP</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000014797'>
<rdfs:label>Lichfield</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000014814'>
<rdfs:label>St. John's</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000015052'>
<rdfs:label>Staffordshire</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000024610'>
<rdfs:label>Lichfield</rdfs:label>
</rdf:Description>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000042775'>
<rdfs:label>Lichfield City South</rdfs:label>
</rdf:Description>
<rdf:RDF xmlns:geo='http://www.w3.org/2003/01/geo/wgs84_pos#' xmlns:ns0='http://data.ordnancesurvey.co.uk/ontology/postcode/' xmlns:osadmingeo='http://data.ordnancesurvey.co.uk/ontology/admingeo/' xmlns:owl='http://www.w3.org/2002/07/owl#' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#' xmlns:spatialrelations='http://data.ordnancesurvey.co.uk/ontology/spatialrelations/'>
<ns0:PostcodeUnit rdf:about='http://uk-postcodes.com/postcode/WS149SQ'>
<rdfs:label>WS14 9SQ</rdfs:label>
<osadmingeo:CivilParish rdf:resource='http://data.ordnancesurvey.co.uk/id/7000000000014792' />
<osadmingeo:County rdf:resource='http://data.ordnancesurvey.co.uk/id/7000000000015052' />
<osadmingeo:CountyElectoralDivision rdf:resource='http://data.ordnancesurvey.co.uk/id/7000000000042775' />
<osadmingeo:District rdf:resource='http://data.ordnancesurvey.co.uk/id/7000000000014797' />
<osadmingeo:DistrictWard rdf:resource='http://data.ordnancesurvey.co.uk/id/7000000000014814' />
<osadmingeo:WestminsterConstituency rdf:resource='http://data.ordnancesurvey.co.uk/id/7000000000024610' />
<osadmingeo:CivilParish>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000014792'>
<rdfs:label>Lichfield CP</rdfs:label>
</rdf:Description>
</osadmingeo:CivilParish>
<osadmingeo:County>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000015052'>
<rdfs:label>Staffordshire</rdfs:label>
</rdf:Description>
</osadmingeo:County>
<osadmingeo:CountyElectoralDivision>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000042775'>
<rdfs:label>Lichfield City South</rdfs:label>
</rdf:Description>
</osadmingeo:CountyElectoralDivision>
<osadmingeo:District>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000014797'>
<rdfs:label>Lichfield</rdfs:label>
</rdf:Description>
</osadmingeo:District>
<osadmingeo:DistrictWard>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000014814'>
<rdfs:label>St. John's</rdfs:label>
</rdf:Description>
</osadmingeo:DistrictWard>
<osadmingeo:WestminsterConstituency>
<rdf:Description rdf:about='http://data.ordnancesurvey.co.uk/id/7000000000024610'>
<rdfs:label>Lichfield</rdfs:label>
</rdf:Description>
</osadmingeo:WestminsterConstituency>
<spatialrelations:easting rdf:datatype='http://www.w3.org/2001/XMLSchema#integer'>412617</spatialrelations:easting>
<spatialrelations:northing rdf:datatype='http://www.w3.org/2001/XMLSchema#integer'>308885</spatialrelations:northing>
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/E07000194' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/E10000028' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/E05006958' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/E14000791' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/E04008932' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/E10000028' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/E05006958' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/E14000791' />
<spatialrelations:t_spatiallyInside rdf:resource='http://statistics.data.gov.uk/id/statistical-geography/E04008932' />
<owl:sameAs rdf:resource='http://data.ordnancesurvey.co.uk/id/postcodeunit/WS149SQ' />
<geo:lat rdf:datatype='http://www.w3.org/2001/XMLSchema#decimal'>52.67752501534847</geo:lat>
<geo:long rdf:datatype='http://www.w3.org/2001/XMLSchema#decimal'>-1.8148108086293673</geo:long>
</ns0:PostcodeUnit>
</rdf:RDF>
"""

Scenario: Access CSV version
Given I access the CSV version of "AB1 0AA"
Then I should see the following csv:
Expand All @@ -266,4 +275,4 @@ Feature: Accessing postcode data
Scenario: Access nonexistent postcode
Given I access the JSON version of "SW1A 1AA"
Then the response should be "404"
And I should see the error "Postcode SW1A1AA cannot be found"
And I should see the error "Postcode SW1A1AA cannot be found"

0 comments on commit f268eae

Please sign in to comment.