aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/import_issn.py
blob: 6b5978d985802145265996d601cac481276a7654 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import pytest
from fatcat_tools.importers import IssnImporter
from fixtures import api


@pytest.fixture(scope="function")
def issn_importer(api):
    yield IssnImporter(api)

# TODO: use API to check that entities actually created...
def test_issn_importer_batch(issn_importer):
    with open('tests/files/journal_extra_metadata.snip.csv', 'r') as f:
        issn_importer.process_csv_batch(f)

def test_issn_importer(issn_importer):
    with open('tests/files/journal_extra_metadata.snip.csv', 'r') as f:
        issn_importer.process_csv_source(f)

    # fetch most recent editgroup
    changes = issn_importer.api.get_changelog(limit=1)
    eg = changes[0].editgroup
    assert eg.description
    assert "container" in eg.description.lower()
    assert eg.extra['git_rev']
    assert "fatcat_tools.IssnImporter" in eg.extra['agent']