0001-api-add-schema-endpoint-for-cards-46999.patch
tests/test_api.py | ||
---|---|---|
3195 | 3195 |
assert resp.json['data'][0]['digest'] == formdata.digest |
3196 | 3196 |
assert resp.json['data'][0]['text'] == formdata.digest |
3197 | 3197 | |
3198 |
# get schema |
|
3199 |
resp = get_app(pub).get(sign_uri('/api/cards/test/@schema'), status=200) |
|
3200 |
assert len(resp.json['fields']) == 1 |
|
3201 |
assert resp.json['fields'][0]['label'] == 'foobar' |
|
3202 |
assert resp.json['fields'][0]['varname'] == 'foo' |
|
3203 | ||
3198 | 3204 | |
3199 | 3205 |
def test_api_invalid_http_basic_auth(pub, local_user, admin_user, ics_data): |
3200 | 3206 |
app = get_app(pub) |
wcs/api.py | ||
---|---|---|
229 | 229 | |
230 | 230 |
class ApiCardPage(ApiFormPage): |
231 | 231 |
formdef_class = CardDef |
232 |
_q_exports = [('list', 'json'), 'geojson', 'ods', ('@schema', 'schema')] # restrict to API endpoints |
|
233 | ||
234 |
def schema(self): |
|
235 |
get_response().set_content_type('application/json') |
|
236 |
return self.formdef.export_to_json(anonymise=not is_url_signed()) |
|
232 | 237 | |
233 | 238 | |
234 | 239 |
class ApiFormsDirectory(Directory): |
235 |
- |