summaryrefslogtreecommitdiffstats
path: root/tests/test_issue_db.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-10-23 00:06:50 -0700
committerBryan Newbold <bnewbold@archive.org>2020-10-23 00:06:50 -0700
commit3161319d0fe3feafe2b5fed48b9383680f9f0547 (patch)
treee0bfda2fe6bec3786743e90418b8e295e0419682 /tests/test_issue_db.py
parentd52f5c1d5de7193ef367c812bc741ebd52655bdd (diff)
downloadfatcat-scholar-3161319d0fe3feafe2b5fed48b9383680f9f0547.tar.gz
fatcat-scholar-3161319d0fe3feafe2b5fed48b9383680f9f0547.zip
basic test for issue-db pipeline
Diffstat (limited to 'tests/test_issue_db.py')
-rw-r--r--tests/test_issue_db.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_issue_db.py b/tests/test_issue_db.py
new file mode 100644
index 0000000..b29eea0
--- /dev/null
+++ b/tests/test_issue_db.py
@@ -0,0 +1,26 @@
+
+import elasticsearch
+import fatcat_openapi_client
+
+from fatcat_scholar.issue_db import IssueDB
+from fatcat_scholar.config import settings
+
+
+def test_issue_db_basics() -> None:
+
+ api_conf = fatcat_openapi_client.Configuration()
+ api_conf.host = settings.FATCAT_API_HOST
+ api = fatcat_openapi_client.DefaultApi(
+ fatcat_openapi_client.ApiClient(api_conf)
+ )
+
+ es_client = elasticsearch.Elasticsearch(settings.FATCAT_ELASTICSEARCH_BACKEND)
+
+ issue_db = IssueDB(settings.SCHOLAR_ISSUEDB_PATH)
+ issue_db.init_db()
+
+ with open('tests/files/sim_collections.json', 'r') as f:
+ issue_db.load_pubs(f.readlines(), api)
+
+ with open('tests/files/sim_items.json', 'r') as f:
+ issue_db.load_issues(f.readlines(), es_client)