Exemplo n.º 1
0
def return_fielded_format_export(solr_data,
                                 fielded_style,
                                 request_type='POST'):
    """

    :param solr_data:
    :param fielded_style:
    :return:
    """
    if (solr_data is not None):
        fielded_export = FieldedFormat(solr_data)
        if fielded_style == 'ADS':
            return return_response(fielded_export.get_ads_fielded(), 200,
                                   request_type)
        if fielded_style == 'EndNote':
            return return_response(fielded_export.get_endnote_fielded(), 200,
                                   request_type)
        if fielded_style == 'ProCite':
            return return_response(fielded_export.get_procite_fielded(), 200,
                                   request_type)
        if fielded_style == 'Refman':
            return return_response(fielded_export.get_refman_fielded(), 200,
                                   request_type)
        if fielded_style == 'RefWorks':
            return return_response(fielded_export.get_refworks_fielded(), 200,
                                   request_type)
        if fielded_style == 'MEDLARS':
            return return_response(fielded_export.get_medlars_fielded(), 200,
                                   request_type)

    return return_response({'error': 'no result from solr'}, 404)
Exemplo n.º 2
0
 def test_medlars(self):
     # format the stubdata using the code
     fielded_export = FieldedFormat(solrdata.data).get_medlars_fielded()
     # now compare it with an already formatted data that we know is correct
     assert (fielded_export == fieldedTest.data_medlars)