@@ -110,17 +110,27 @@ async def test_app_context_extension(app_client, ctx, txn_client):
110
110
assert matched == 1
111
111
112
112
113
- @pytest .mark .skip (reason = "fields not implemented yet" )
114
- async def test_app_fields_extension (load_test_data , app_client , txn_client ):
115
- item = load_test_data ("test_item.json" )
116
- txn_client .create_item (item , request = MockRequest , refresh = True )
117
-
113
+ async def test_app_fields_extension (app_client , ctx , txn_client ):
118
114
resp = await app_client .get ("/search" , params = {"collections" : ["test-collection" ]})
119
115
assert resp .status_code == 200
120
116
resp_json = resp .json ()
121
117
assert list (resp_json ["features" ][0 ]["properties" ]) == ["datetime" ]
122
118
123
- txn_client .delete_item (item ["id" ], item ["collection" ])
119
+
120
+ async def test_app_fields_extension_return_all_properties (app_client , ctx , txn_client ):
121
+ item = ctx .item
122
+ resp = await app_client .get (
123
+ "/search" , params = {"collections" : ["test-collection" ], "fields" : "properties" }
124
+ )
125
+ assert resp .status_code == 200
126
+ resp_json = resp .json ()
127
+ feature = resp_json ["features" ][0 ]
128
+ assert len (feature ["properties" ]) >= len (item ["properties" ])
129
+ for expected_prop , expected_value in item ["properties" ].items ():
130
+ if expected_prop in ("datetime" , "created" , "updated" ):
131
+ assert feature ["properties" ][expected_prop ][0 :19 ] == expected_value [0 :19 ]
132
+ else :
133
+ assert feature ["properties" ][expected_prop ] == expected_value
124
134
125
135
126
136
async def test_app_query_extension_gt (app_client , ctx ):
0 commit comments