summaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/api_client.py15
-rw-r--r--python/tests/crossref.py16
-rw-r--r--python/tests/fixtures.py17
-rw-r--r--python/tests/orcid.py2
4 files changed, 21 insertions, 29 deletions
diff --git a/python/tests/api_client.py b/python/tests/api_client.py
deleted file mode 100644
index 9d2ec302..00000000
--- a/python/tests/api_client.py
+++ /dev/null
@@ -1,15 +0,0 @@
-
-import pytest
-import fatcat.api_client
-from fixtures import *
-
-
-# TODO:
-#def test_client_health(api_client):
-# assert api_client.health() != None
-
-
-def test_import_crossref(api_client):
- api_client.import_crossref_file('tests/files/crossref-works.2018-01-21.badsample.json')
-
- # TODO: use API to check that entities actually created...
diff --git a/python/tests/crossref.py b/python/tests/crossref.py
new file mode 100644
index 00000000..e72f7d02
--- /dev/null
+++ b/python/tests/crossref.py
@@ -0,0 +1,16 @@
+
+import pytest
+from fatcat.crossref_importer import FatcatCrossrefImporter
+
+
+@pytest.fixture(scope="function")
+def crossref_importer():
+ yield FatcatCrossrefImporter("http://localhost:9411/v0")
+
+def test_crossref_importer_batch(crossref_importer):
+ with open('tests/files/crossref-works.2018-01-21.badsample.json', 'r') as f:
+ crossref_importer.process_batch(f)
+
+def test_crossref_importer(crossref_importer):
+ with open('tests/files/crossref-works.2018-01-21.badsample.json', 'r') as f:
+ crossref_importer.process_source(f)
diff --git a/python/tests/fixtures.py b/python/tests/fixtures.py
index b1682e79..c9da9253 100644
--- a/python/tests/fixtures.py
+++ b/python/tests/fixtures.py
@@ -19,23 +19,12 @@ def app(full_app):
@pytest.fixture(scope="function")
-def api_client(full_app):
-
- # TODO:
- #pid = os.fork()
- #if pid == 0:
- # full_app.testing = False
- # full_app.run(host="localhost", port=8444, debug=False)
- # os._exit(0)
- #
- #time.sleep(0.2)
- #yield fatcat.api_client.FatCatApiClient("http://localhost:8444")
- #os.kill(pid, signal.SIGKILL)
-
- yield fatcat.api_client.FatCatApiClient("http://localhost:9411")
+def raw_api_client():
+ yield fatcat.raw_api_client.RawFatcatApiClient("http://localhost:9411")
## Helpers ##################################################################
+# TODO: what are these even here for?
def check_entity_fields(e):
for key in ('rev', 'is_live', 'redirect_id'):
diff --git a/python/tests/orcid.py b/python/tests/orcid.py
index 86a23603..d0e99cfc 100644
--- a/python/tests/orcid.py
+++ b/python/tests/orcid.py
@@ -2,10 +2,12 @@
import pytest
from fatcat.orcid_importer import FatcatOrcidImporter
+
@pytest.fixture(scope="function")
def orcid_importer():
yield FatcatOrcidImporter("http://localhost:9411/v0")
+# TODO: use API to check that entities actually created...
def test_orcid_importer_batch(orcid_importer):
with open('tests/files/0000-0001-8254-7103.json', 'r') as f:
orcid_importer.process_batch(f)