summaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/files/journal_extra_metadata.snip.csv10
-rw-r--r--python/tests/files/journal_metadata.sample.json20
-rw-r--r--python/tests/import_journal_metadata.py18
3 files changed, 29 insertions, 19 deletions
diff --git a/python/tests/files/journal_extra_metadata.snip.csv b/python/tests/files/journal_extra_metadata.snip.csv
deleted file mode 100644
index 8cc50ee9..00000000
--- a/python/tests/files/journal_extra_metadata.snip.csv
+++ /dev/null
@@ -1,10 +0,0 @@
-ISSN-L,in_doaj,in_road,in_norwegian,in_crossref,title,publisher,url,lang,ISSN-print,ISSN-electronic,doi_count,has_doi,is_oa,is_kept,publisher_size,url_live,url_live_status,url_live_final_status,url_live_final_url,url_live_status_simple,url_live_final_status_simple,url_domain,gwb_pdf_count
-0000-0019,False,False,True,False,Publishers weekly,,http://www.publishersweekly.com/,,0000-0019,2150-4008,0.0,False,False,False,,http://www.publishersweekly.com/,301.0,200.0,https://www.publishersweekly.com/,3xx,200,publishersweekly.com,1055.0
-0001-0782,False,False,True,True,Communications of the ACM,Association for Computing Machinery,http://www.acm.org/pubs/cacm/,,0001-0782,1557-7317,11894.0,True,False,True,55.0,http://www.acm.org/pubs/cacm/,301.0,200.0,https://cacm.acm.org/,3xx,200,acm.org,9.0
-0001-1452,False,False,True,True,AIAA Journal,American Institute of Aeronautics and Astronautics,http://www.aiaa.org/content.cfm?pageid=322&lupubid=2,,0001-1452,1533-385X,24193.0,True,False,True,6.0,http://www.aiaa.org/content.cfm?pageid=322&lupubid=2,404.0,404.0,http://www.aiaa.org/content.cfm?pageid=322&lupubid=2,404,404,aiaa.org,16.0
-0001-1541,False,False,True,True,AIChE Journal,Wiley Blackwell (John Wiley & Sons),http://www.aiche.org/Publications/AIChEJournal/index.aspx,,0001-1541,1547-5905,15860.0,True,False,True,607.0,http://www.aiche.org/Publications/AIChEJournal/index.aspx,301.0,200.0,https://www.aiche.org/publications/journals/aiche-journal,3xx,200,aiche.org,25.0
-0001-2092,False,False,True,True,AORN Journal,Wiley Blackwell (John Wiley & Sons),http://www.aorn.org/AORNJournal/,,0001-2092,1878-0369,12413.0,True,False,True,607.0,http://www.aorn.org/AORNJournal/,301.0,200.0,https://www.aorn.org/aorn-journal,3xx,200,aorn.org,0.0
-0001-2343,False,False,True,True,Archiv fuer Rechts- und Sozialphilosphie,Franz Steiner Verlag GmbH,http://www.steiner-verlag.de/programm/zeitschriften/archiv-fuer-rechts-und-sozialphilosophie/,,0001-2343,2363-5614,14.0,True,False,False,2.0,http://www.steiner-verlag.de/programm/zeitschriften/archiv-fuer-rechts-und-sozialphilosophie/,200.0,200.0,http://www.steiner-verlag.de/programm/zeitschriften/archiv-fuer-rechts-und-sozialphilosophie/,200,200,steiner-verlag.de,226.0
-0001-2351,False,False,True,True,Transactions of the ASAE,American Society of Agricultural and Biological Engineers,,,0001-2351,2151-0059,11515.0,True,False,True,3.0,,,,,,,,0.0
-0001-2491,False,False,True,False,ASHRAE Journal,,http://www.ashrae.org/,,0001-2491,1943-6637,0.0,False,False,False,,http://www.ashrae.org/,301.0,200.0,https://www.ashrae.org/,3xx,200,ashrae.org,684.0
-0001-2505,False,False,True,False,ASHRAE Transactions,,http://www.ashrae.org/template/AssetDetail/assetid/25903,,0001-2505,,0.0,False,False,False,,http://www.ashrae.org/template/AssetDetail/assetid/25903,301.0,404.0,https://www.ashrae.org/template/AssetDetail/assetid/25903,3xx,404,ashrae.org,684.0
diff --git a/python/tests/files/journal_metadata.sample.json b/python/tests/files/journal_metadata.sample.json
new file mode 100644
index 00000000..56df2ea1
--- /dev/null
+++ b/python/tests/files/journal_metadata.sample.json
@@ -0,0 +1,20 @@
+{"publisher": "Peter Lang International Academic Publishers", "sherpa_romeo": {"color": "yellow"}, "name": "Monographs in Linguistics and the Philosophy of Language", "issnp": "1056-5019", "issnl": "1056-5019"}
+{"ia": {"homepage_url": "http://arjournals.annualreviews.org/loi/pharmtox", "homepage_status": -1}, "issnp": "0362-1642", "issne": "1545-4304", "urls": ["http://arjournals.annualreviews.org/loi/pharmtox"], "publisher": "Annual Reviews", "kbart": {"portico": {"year_spans": [[2011, 2017]]}}, "country": "us", "abbrev": "Annu. Rev. Pharmacol. Toxicol.", "crossref": {"any": true, "doi": "10.1146/pharmtox.711"}, "languages": ["en"], "issnl": "0362-1642", "name": "Annual Review of Pharmacology and Toxicology", "sherpa_romeo": {"color": "yellow"}, "norwegian": {"level": 1, "as_of": "2018-03-02", "id": 437839}, "sim": {"last_year": 2009, "id": "5091", "year_spans": [[1961, 2009]], "first_year": 1961}}
+{"name": "The international journal of applied radiation and isotopes", "issnp": "0020-708X", "issne": "1878-1284", "publisher": "Elsevier", "kbart": {"clockss": {"year_spans": [[1957, 1985]]}, "portico": {"year_spans": [[1956, 1985]]}}, "norwegian": {"level": 1, "as_of": "2018-03-02", "id": 447572}, "abbrev": "Int J Appl Radiat Isot", "crossref": {"any": true}, "issnl": "0020-708X"}
+{"issnp": "2449-8920", "issne": "2449-8939", "road": {"as_of": "2018-01-24"}, "languages": ["en"], "publisher": "Uniwersytet Jagiellonski \u2013 Wydawnictwo Uniwersytetu Jagiellonskiego", "country": "pl", "urls": ["http://www.ejournals.eu/ijcm/", "http://www.ejournals.eu/ijcm"], "crossref": {"any": true}, "issnl": "2449-8920", "name": "International Journal of Contemporary Management", "norwegian": {"level": 1, "as_of": "2018-03-02", "id": 488900}, "ia": {"homepage_url": "http://www.ejournals.eu/ijcm", "homepage_status": 200}}
+{"issnp": "1976-1317", "default_license": "CC-BY-NC-ND", "road": {"as_of": "2018-01-24"}, "doaj": {"as_of": "2019-01-24", "seal": false, "archive": ["national-library"]}, "languages": ["en"], "publisher": "Elsevier", "kbart": {"clockss": {"year_spans": [[2007, 2018]]}, "portico": {"year_spans": [[2007, 2018]]}}, "country": "kr", "urls": ["http://www.journals.elsevier.com/asian-nursing-research", "http://www.asian-nursingresearch.com"], "crossref": {"any": true}, "issnl": "1976-1317", "abbrev": "Asian Nurs Res (Korean Soc Nurs Sci)", "name": "Asian Nursing Research", "sherpa_romeo": {"color": "green"}, "ia": {"homepage_url": "https://www.journals.elsevier.com/asian-nursing-research", "homepage_status": 200}, "issne": "2093-7482"}
+{"name": "Research on Managing Groups and Teams", "issnp": "1534-0856", "languages": ["en"], "ia": {"homepage_url": "http://www.emeraldinsight.com/series/rmgt", "homepage_status": -1}, "country": "us", "urls": ["http://www.emeraldinsight.com/series/rmgt"], "norwegian": {"level": 1, "as_of": "2018-03-02", "id": 484721}, "issnl": "1534-0856"}
+{"name": "Asian Journal of Medical Sciences", "issne": "2091-0576", "road": {"as_of": "2018-01-24"}, "languages": ["en"], "publisher": "Manipal Colleges of Medical Sciences", "ia": {"homepage_url": "https://www.nepjol.info/index.php/AJMS", "homepage_status": 200}, "country": "np", "urls": ["http://www.nepjol.info/index.php/AJMS/about", "http://www.nepjol.info/index.php/AJMS"], "norwegian": {"level": 1, "as_of": "2018-03-02", "id": 478318}, "issnl": "2091-0576"}
+{"name": "ATZproduktion", "issnp": "1865-4908", "issne": "2192-8886", "publisher": "Springer Fachmedien Wiesbaden GmbH", "crossref": {"any": true}, "issnl": "1865-4908"}
+{"publisher": "Boom Uitgevers Den Haag", "name": "StAB", "issnp": "1573-806X", "crossref": {"any": true}, "issnl": "1573-806X"}
+{"publisher": "University of Victoria", "sherpa_romeo": {"color": "blue"}, "name": "Musicological Explorations", "issnp": "1711-9235", "issnl": "1711-9235"}
+{"publisher": "Transstellar Journal Publications and Research Consultancy Private Limited", "name": "International Journal of Robotics Research and Development", "issnp": "2250-1592", "crossref": {"any": true}, "issnl": "2250-1592"}
+{"name": "BioProcess international", "issnp": "1542-6319", "abbrev": "Bioprocess Int", "issne": "1945-7065", "issnl": "1542-6319"}
+{"name": "Journal of the American Podiatry Association", "issnp": "0003-0538", "abbrev": "J Am Podiatry Assoc", "issnl": "0003-0538"}
+{"publisher": "Masson Editeur", "name": "Bulletin de la Societe francaise de dermatologie et de syphiligraphie", "languages": ["en"], "sim": {"last_year": 1972, "id": "3407", "year_spans": [[1890, 1941], [1968, 1972]], "gaps": [1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967], "first_year": 1890}, "issnl": "0049-1071"}
+{"name": "International journal of innovative and applied research", "urls": ["http://www.journalijiar.com"], "ia": {"homepage_url": "http://www.journalijiar.com/", "homepage_status": 200}, "road": {"as_of": "2018-01-24"}, "issnl": "2348-0319"}
+{"issnp": "1025-6415", "issne": "1025-6415", "road": {"as_of": "2018-01-24"}, "languages": ["ru"], "publisher": "Natsional'na Akademiya Nauk Ukrainy", "abbrev": "Dopov Natsionalnoi Akad Nauk Ukr Matemat Pryrodoznavstvo Tekhnichni Nauky", "country": "ua", "urls": ["http://www.nbuv.gov.ua/portal/all/reports/index.html", "http://dopovidi-nanu.org.ua/"], "crossref": {"any": true, "doi": "10.15407/dopovidi"}, "issnl": "1025-6415", "name": "Natsional'na Akademiya Nauk Ukrainy. Dopovidi: naukovyi zhurnal", "norwegian": {"level": 1, "as_of": "2018-03-02", "id": 477246}, "ia": {"homepage_url": "http://dopovidi-nanu.org.ua/", "homepage_status": 200}}
+{"publisher": "International Bee Research Association", "name": "Journal of ApiProduct and ApiMedical Science", "crossref": {"any": true, "doi": "10.3896/IBRA.4"}, "issne": "1759-7986", "issnl": "1759-7986"}
+{"publisher": "E3 Journals Ltd", "name": "E3 Journal of Agricultural Research and Development", "crossref": {"any": true, "doi": "10.18685/EJARD"}, "issne": "2276-9897", "issnl": "2276-9897"}
+{"name": "Tung wu hsueh tsa chih : Dongwuxue zazhi", "issnp": "0250-3263", "abbrev": "Dongwuxue Zazhi", "issnl": "0250-3263"}
+{"name": "Buca e\u011fitim fak\u00fcltesi dergisi (Online)", "urls": ["http://www.befjournal.com/index.php/dergi/index"], "ia": {"homepage_url": "http://www.befjournal.com/cgi-sys/suspendedpage.cgi", "homepage_status": 200}, "road": {"as_of": "2018-01-24"}, "issnl": "1302-5147"}
diff --git a/python/tests/import_journal_metadata.py b/python/tests/import_journal_metadata.py
index a2b10a65..cfeee517 100644
--- a/python/tests/import_journal_metadata.py
+++ b/python/tests/import_journal_metadata.py
@@ -1,6 +1,6 @@
import pytest
-from fatcat_tools.importers import JournalMetadataImporter, CsvPusher
+from fatcat_tools.importers import JournalMetadataImporter, JsonLinePusher
from fixtures import api
@@ -10,15 +10,15 @@ def journal_metadata_importer(api):
# TODO: use API to check that entities actually created...
def test_journal_metadata_importer_batch(journal_metadata_importer):
- with open('tests/files/journal_extra_metadata.snip.csv', 'r') as f:
- CsvPusher(journal_metadata_importer, f).run()
+ with open('tests/files/journal_metadata.sample.json', 'r') as f:
+ JsonLinePusher(journal_metadata_importer, f).run()
def test_journal_metadata_importer(journal_metadata_importer):
last_index = journal_metadata_importer.api.get_changelog(limit=1)[0].index
- with open('tests/files/journal_extra_metadata.snip.csv', 'r') as f:
+ with open('tests/files/journal_metadata.sample.json', 'r') as f:
journal_metadata_importer.bezerk_mode = True
- counts = CsvPusher(journal_metadata_importer, f).run()
- assert counts['insert'] == 9
+ counts = JsonLinePusher(journal_metadata_importer, f).run()
+ assert counts['insert'] == 20
assert counts['exists'] == 0
assert counts['skip'] == 0
@@ -30,10 +30,10 @@ def test_journal_metadata_importer(journal_metadata_importer):
assert eg.extra['git_rev']
assert "fatcat_tools.JournalMetadataImporter" in eg.extra['agent']
- with open('tests/files/journal_extra_metadata.snip.csv', 'r') as f:
+ with open('tests/files/journal_metadata.sample.json', 'r') as f:
journal_metadata_importer.reset()
journal_metadata_importer.bezerk_mode = False
- counts = CsvPusher(journal_metadata_importer, f).run()
+ counts = JsonLinePusher(journal_metadata_importer, f).run()
assert counts['insert'] == 0
- assert counts['exists'] == 9
+ assert counts['exists'] == 20
assert counts['skip'] == 0