def test_serializer(session, accession): session.add(accession) session.commit() accession_json = accession.jsonify() # class and instance json are the same assert Accession.jsonify(accession) == accession_json assert accession_json['taxon']['id'] == accession.taxon_id assert accession_json['taxon_str'] == accession.taxon_str()
def index_accession(): accession = Accession.query.all() data = Accession.jsonify(accession, many=True) return utils.json_response(data)