def step_impl_then_get_rendition_with_mimetype(context, name, mimetype): expect_json_contains(context.response, 'renditions') renditions = apply_path(parse_json_response(context.response), 'renditions') assert isinstance(renditions, dict), 'expected dict for image renditions' desc = renditions[name] assert isinstance(desc, dict), 'expected dict for rendition description' assert 'href' in desc, 'expected href in rendition description' we_can_fetch_a_file(context, desc['href'], mimetype)
def step_impl_then_get_file_meta(context): assert len( apply_path( parse_json_response(context.response), 'filemeta' ).items() ) > 0 'expected non empty metadata dictionary'
def step_impl_then_get_renditions(context, type): expect_json_contains(context.response, 'renditions') renditions = apply_path(parse_json_response(context.response), 'renditions') assert isinstance(renditions, dict), 'expected dict for image renditions' for rend_name in context.app.config['RENDITIONS'][type]: desc = renditions[rend_name] assert isinstance(desc, dict), 'expected dict for rendition description' assert 'href' in desc, 'expected href in rendition description' assert 'media' in desc, 'expected media identifier in rendition description' we_can_fetch_a_file(context, desc['href'], 'image/jpeg')