def test_serializer(session, plant): session.add(plant) session.commit() plant_json = plant.jsonify() # class and instance json are the same assert Plant.jsonify(plant) == plant_json assert 'str' in plant_json assert plant_json['accession']['id'] == plant.accession_id
def index_plant(): plants = Plant.query.all() data = Plant.jsonify(plants, many=True) return utils.json_response(data)