aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_directories.py
blob: 90856bcf6df381289895be1ab7b48fda9ff6f66c (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 chocula import *

@pytest.fixture
def config():
    config = ChoculaConfig.from_file(sources_dir="tests/files/")
    return config

@pytest.fixture
def issn_db():
    return IssnDatabase(issn_issnl_file_path="tests/files/ISSN-to-ISSN-L.txt")

@pytest.fixture
def database(issn_db):
    db = ChoculaDatabase(db_file=":memory:", issn_db=issn_db)
    db.init_db()
    return db

def test_all(config, database):

    for cls in ALL_CHOCULA_DIR_CLASSES:
        loader = cls(config)
        counts = loader.index_file(database)
        assert counts['total'] >= 20
        assert counts['inserted'] > 5