aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/harvest_datacite.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-11-02 18:13:14 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-11-02 18:13:14 -0700
commitcdfd6b85b386b7bbf9d5a5179ef26970b6e5a4e7 (patch)
tree5e4034027b51f3ee4d2a488bb2cbb7a75c3bd0d8 /python/tests/harvest_datacite.py
parent78f08280edea4ff65ca613ad30005c45cc48dea6 (diff)
downloadfatcat-cdfd6b85b386b7bbf9d5a5179ef26970b6e5a4e7.tar.gz
fatcat-cdfd6b85b386b7bbf9d5a5179ef26970b6e5a4e7.zip
fmt (black): tests/
Diffstat (limited to 'python/tests/harvest_datacite.py')
-rw-r--r--python/tests/harvest_datacite.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/python/tests/harvest_datacite.py b/python/tests/harvest_datacite.py
index 0a7584bd..40e5f711 100644
--- a/python/tests/harvest_datacite.py
+++ b/python/tests/harvest_datacite.py
@@ -1,4 +1,3 @@
-
import datetime
import json
@@ -12,13 +11,12 @@ def test_datacite_harvest_date(mocker):
# mock out the harvest state object so it doesn't try to actually connect
# to Kafka
- mocker.patch('fatcat_tools.harvest.harvest_common.HarvestState.initialize_from_kafka')
+ mocker.patch("fatcat_tools.harvest.harvest_common.HarvestState.initialize_from_kafka")
# mock day request to datacite API
- with open('tests/files/datacite_api.json', 'r') as f:
+ with open("tests/files/datacite_api.json", "r") as f:
resp = json.loads(f.readline())
- responses.add(responses.GET, 'https://api.datacite.org/dois',
- json=resp, status=200)
+ responses.add(responses.GET, "https://api.datacite.org/dois", json=resp, status=200)
harvester = HarvestDataciteWorker(
kafka_hosts="dummy",
@@ -34,10 +32,13 @@ def test_datacite_harvest_date(mocker):
assert len(responses.calls) == 1
# ensure email was included in User-Agent
- assert "mailto:test@fatcat.wiki" in responses.calls[0].request.headers['User-Agent']
+ assert "mailto:test@fatcat.wiki" in responses.calls[0].request.headers["User-Agent"]
# check that correct date param was passed as expected
- assert "query=updated%3A%5B2019-02-03T00%3A00%3A00.000Z+TO+2019-02-03T23%3A59%3A59.999Z%5D" in responses.calls[0].request.url
+ assert (
+ "query=updated%3A%5B2019-02-03T00%3A00%3A00.000Z+TO+2019-02-03T23%3A59%3A59.999Z%5D"
+ in responses.calls[0].request.url
+ )
# check that we published the expected number of DOI objects were published
# to the (mock) kafka topic