aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/transform_tests.py
blob: 6d6c6c8266a38faa787cfa5b12b623ff83b6592b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

import json
import pytest
from fatcat_tools import *
from fatcat_client import *
from fixtures import api

from import_crossref import crossref_importer

def test_elasticsearch_convert(crossref_importer):
    with open('tests/files/crossref-works.single.json', 'r') as f:
        # not a single line
        raw = json.loads(f.read())
        r = crossref_importer.parse_record(raw)
    r.state = 'active'
    release_to_elasticsearch(r)

def test_elasticsearch_from_json():
    r = entity_from_json(open('./tests/files/math_universe.json', 'r').read(), ReleaseEntity)
    release_to_elasticsearch(r)