async def delete(self, request, name): for index, data in enumerate(request.app.config.store): if data['name'] == name: request.app.config.store.pop(index) return '', 204 return error('User not found', status=404)
def test_error_with_details(): response = error('Bad Request', {'name': 'Field is required.'}, 400) assert response.status == 400 assert json.loads(response.body) == { 'description': 'Bad Request', 'details': {'name': 'Field is required.'}, }
async def get(self, request, name): for data in request.app.config.store: if data['name'] == name: return data return error('User not found', status=404)