示例#1
0
 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)
示例#2
0
def test_delete_sample_not_avail():
    samples.add_sample(sample)
    assert not samples.delete_sample("not_found")
示例#3
0
def test_delete_sample():
    samples.add_sample(sample)
    assert samples.delete_sample(sample["id"])