diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-05-07 19:56:51 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-05-07 19:56:51 -0700 |
commit | cd03ba1cd1c3e05a16ef2ed326f9847f411ee53d (patch) | |
tree | 75b50eab800d08f3b54f24036dbe1eb797348fba /tests/test_directories.py | |
parent | 485c35f22d5817e524d3252bc13694961c98521f (diff) | |
download | chocula-cd03ba1cd1c3e05a16ef2ed326f9847f411ee53d.tar.gz chocula-cd03ba1cd1c3e05a16ef2ed326f9847f411ee53d.zip |
start of basic tests
Diffstat (limited to 'tests/test_directories.py')
-rw-r--r-- | tests/test_directories.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_directories.py b/tests/test_directories.py new file mode 100644 index 0000000..051059b --- /dev/null +++ b/tests/test_directories.py @@ -0,0 +1,29 @@ + +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 (CrossrefLoader, DoajLoader, EntrezLoader, EzbLoader, + GoldOALoader, NorwegianLoader, OpenAPCLoader, RoadLoader, + SzczepanskiLoader, WikidataLoader): + # XXX: SherpaRomeoLoader + loader = cls(config) + counts = loader.index_file(database) + assert counts['total'] >= 20 + assert counts['inserted'] > 5 |