def update_sample(sample_id): response_object = {'status': 'success'} if request.method == 'PUT': post_data = request.get_json() sample = { 'id': sample_id, 'title': post_data.get('title'), 'author': post_data.get('author'), 'read': post_data.get('read') } log.debug('update_sample %s', sample) samples.update_sample(sample) response_object['message'] = 'Sample updated!' if request.method == 'DELETE': samples.delete_sample(sample_id) response_object['message'] = 'Sample removed!' return jsonify(response_object)
def test_delete_sample_not_avail(): samples.add_sample(sample) assert not samples.delete_sample("not_found")
def test_delete_sample(): samples.add_sample(sample) assert samples.delete_sample(sample["id"])