@@ -28,24 +28,6 @@ import (
2828 "github.com/CrunchyData/pg_featureserv/util"
2929)
3030
31- // Define a FeatureCollection structure for parsing test data
32-
33- type Feature struct {
34- Type string `json:"type"`
35- ID string `json:"id,omitempty"`
36- Geom * json.RawMessage `json:"geometry"`
37- Props map [string ]interface {} `json:"properties"`
38- }
39-
40- type FeatureCollection struct {
41- Type string `json:"type"`
42- Features []* Feature `json:"features"`
43- NumberMatched uint `json:"numberMatched,omitempty"`
44- NumberReturned uint `json:"numberReturned"`
45- TimeStamp string `json:"timeStamp,omitempty"`
46- Links []* api.Link `json:"links"`
47- }
48-
4931var hTest util.HttpTesting
5032
5133var catalogMock * data.CatalogMock
@@ -149,7 +131,7 @@ func TestCollectionItem(t *testing.T) {
149131func TestFilterB (t * testing.T ) {
150132 rr := hTest .DoRequest (t , "/collections/mock_a/items?prop_b=1" )
151133
152- var v FeatureCollection
134+ var v util. FeatureCollection
153135 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
154136 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
155137
@@ -159,7 +141,7 @@ func TestFilterB(t *testing.T) {
159141func TestFilterD (t * testing.T ) {
160142 rr := hTest .DoRequest (t , "/collections/mock_c/items?prop_d=1" )
161143
162- var v FeatureCollection
144+ var v util. FeatureCollection
163145 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
164146 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
165147
@@ -169,7 +151,7 @@ func TestFilterD(t *testing.T) {
169151func TestFilterBD (t * testing.T ) {
170152 rr := hTest .DoRequest (t , "/collections/mock_c/items?prop_b=2&prop_d=2" )
171153
172- var v FeatureCollection
154+ var v util. FeatureCollection
173155 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
174156 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
175157
@@ -179,7 +161,7 @@ func TestFilterBD(t *testing.T) {
179161func TestFilterBDNone (t * testing.T ) {
180162 rr := hTest .DoRequest (t , "/collections/mock_c/items?prop_b=1&prop_d=2" )
181163
182- var v FeatureCollection
164+ var v util. FeatureCollection
183165 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
184166 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
185167
@@ -189,7 +171,7 @@ func TestFilterBDNone(t *testing.T) {
189171func TestSortBy (t * testing.T ) {
190172 rr := hTest .DoRequest (t , "/collections/mock_a/items?sortby=prop_b" )
191173
192- var v FeatureCollection
174+ var v util. FeatureCollection
193175 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
194176 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
195177
@@ -199,7 +181,7 @@ func TestSortBy(t *testing.T) {
199181func TestSortByDesc (t * testing.T ) {
200182 rr := hTest .DoRequest (t , "/collections/mock_a/items?sortby=-prop_b" )
201183
202- var v FeatureCollection
184+ var v util. FeatureCollection
203185 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
204186 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
205187
@@ -209,7 +191,7 @@ func TestSortByDesc(t *testing.T) {
209191func TestSortByAsc (t * testing.T ) {
210192 rr := hTest .DoRequest (t , "/collections/mock_a/items?sortby=+prop_b" )
211193
212- var v FeatureCollection
194+ var v util. FeatureCollection
213195 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
214196 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
215197
@@ -219,7 +201,7 @@ func TestSortByAsc(t *testing.T) {
219201func TestLimit (t * testing.T ) {
220202 rr := hTest .DoRequest (t , "/collections/mock_a/items?limit=3" )
221203
222- var v FeatureCollection
204+ var v util. FeatureCollection
223205 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
224206 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
225207
@@ -232,7 +214,7 @@ func TestLimit(t *testing.T) {
232214func TestLimitZero (t * testing.T ) {
233215 rr := hTest .DoRequest (t , "/collections/mock_a/items?limit=0" )
234216
235- var v FeatureCollection
217+ var v util. FeatureCollection
236218 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
237219 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
238220
@@ -247,7 +229,7 @@ func TestLimitInvalid(t *testing.T) {
247229func TestQueryParamCase (t * testing.T ) {
248230 rr := hTest .DoRequest (t , "/collections/mock_a/items?LIMIT=2&Offset=4" )
249231
250- var v FeatureCollection
232+ var v util. FeatureCollection
251233 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
252234 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
253235
@@ -259,7 +241,7 @@ func TestQueryParamCase(t *testing.T) {
259241func TestOffset (t * testing.T ) {
260242 rr := hTest .DoRequest (t , "/collections/mock_a/items?limit=2&offset=4" )
261243
262- var v FeatureCollection
244+ var v util. FeatureCollection
263245 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
264246 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
265247
@@ -302,7 +284,7 @@ func TestProperties(t *testing.T) {
302284 // - non-existing names are ignored
303285 rr := hTest .DoRequest (t , "/collections/mock_a/items?limit=2&properties=PROP_A,prop_C,prop_a,not_prop" )
304286
305- var v FeatureCollection
287+ var v util. FeatureCollection
306288 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
307289 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
308290
@@ -316,7 +298,7 @@ func TestProperties(t *testing.T) {
316298func TestPropertiesAll (t * testing.T ) {
317299 rr := hTest .DoRequest (t , "/collections/mock_a/items?limit=2" )
318300
319- var v FeatureCollection
301+ var v util. FeatureCollection
320302 errUnMarsh := json .Unmarshal (hTest .ReadBody (rr ), & v )
321303 util .Assert (t , errUnMarsh == nil , fmt .Sprintf ("%v" , errUnMarsh ))
322304
0 commit comments