@@ -232,32 +232,36 @@ def perform_request(self):
232232 continue
233233
234234 if len (items ['features' ]) > 0 :
235+ item = items ['features' ][0 ]
236+
237+ fid = item .get ('id' , None )
238+ if fid is not None :
239+ try :
240+ item = oa_feat .collection_item (coll_id , fid )
241+ except Exception as e :
242+ msg = 'GetItem by id=%s from %s: OWSLib err: %s' \
243+ % (str (fid ), coll_id , str (e ))
244+ result = push_result (
245+ self , result , False , msg , 'Test GetItem' )
246+ continue
247+
248+ # At least these attributes should be present, 'id' and 'links'
249+ # not strictly required.
250+ for attr in ['properties' , 'geometry' , 'type' ]:
235251
236- fid = items ['features' ][0 ]['id' ]
237- try :
238- item = oa_feat .collection_item (coll_id , fid )
239- except Exception as e :
240- msg = 'GetItem %s: OWSLib err: %s' \
241- % (str (e ), coll_id )
242- result = push_result (
243- self , result , False , msg , 'Test GetItem' )
244- continue
245-
246- for attr in \
247- ['id' , 'links' , 'properties' , 'geometry' , 'type' ]:
248252 val = item .get (attr , None )
249253 if val is None :
250254 msg = '%s:%s missing attr: %s' \
251255 % (coll_id , str (fid ), attr )
252256 result = push_result (
253- self , result , False , msg , 'Test GetItem ' )
257+ self , result , False , msg , 'Test Feature attrs present ' )
254258 continue
255259
256260 if attr == 'type' and val != 'Feature' :
257261 msg = '%s:%s type not Feature: %s' \
258262 % (coll_id , str (fid ), val )
259263 result = push_result (
260- self , result , False , msg , 'Test GetItem ' )
264+ self , result , False , msg , 'Test attr type=Feature ' )
261265 continue
262266
263267 except Exception as err :
0 commit comments