Skip to content

Commit

Permalink
Add stub_data_dir fixture to retraction test (#420)
Browse files Browse the repository at this point in the history
Co-authored-by: James Braza <[email protected]>
  • Loading branch information
geemi725 and jamesbraza authored Sep 16, 2024
1 parent 9d49b84 commit 67b16c5
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 6 deletions.
53 changes: 53 additions & 0 deletions tests/cassettes/test_crossref_retraction_status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
interactions:
- request:
body: null
headers: {}
method: GET
uri: https://api.crossref.org/[email protected]&query.title=The+Dilemma+and+Countermeasures+of+Music+Education+under+the+Background+of+Big+Data&rows=1&select=DOI,author,container-title,title
response:
body:
string:
'{"status":"ok","message-type":"work-list","message-version":"1.0.0","message":{"facets":{},"total-results":4250430,"items":[{"DOI":"10.1155\/2022\/8341966","author":[{"ORCID":"http:\/\/orcid.org\/0000-0003-3902-2613","authenticated-orcid":true,"given":"Jiaye","family":"Han","sequence":"first","affiliation":[{"name":"Pingdingshan
Polytechnic College, PingDingShan, Henan 467001, China"},{"name":"National
University of Life and Environmental Sciences of Ukraine, Kyiv 03041, Ukraine"}]}],"container-title":["Wireless
Communications and Mobile Computing"],"title":["The Dilemma and Countermeasures
of Music Education under the Background of Big Data"]}],"items-per-page":1,"query":{"start-index":0,"search-terms":null}}}'
headers:
Access-Control-Allow-Headers:
- X-Requested-With, Accept, Accept-Encoding, Accept-Charset, Accept-Language,
Accept-Ranges, Cache-Control
Access-Control-Allow-Origin:
- "*"
Access-Control-Expose-Headers:
- Link
Connection:
- close
Content-Type:
- application/json
Date:
- Sat, 14 Sep 2024 21:41:42 GMT
Server:
- Jetty(9.4.40.v20210413)
Set-Cookie:
- AWSALB=WoXDQTOarfiX9ISjhdhDDDhyB7XX/E7HBTVazMznn5Y6fEM/3cK4quSmODhVa3+NgmM5t55XUJ4A+VQvKNl0sVn/IruGSlBknqgHGQlZzQWJIoM+LAwTmPaUGhdR;
Expires=Sat, 21 Sep 2024 21:41:39 GMT; Path=/
- AWSALBCORS=WoXDQTOarfiX9ISjhdhDDDhyB7XX/E7HBTVazMznn5Y6fEM/3cK4quSmODhVa3+NgmM5t55XUJ4A+VQvKNl0sVn/IruGSlBknqgHGQlZzQWJIoM+LAwTmPaUGhdR;
Expires=Sat, 21 Sep 2024 21:41:39 GMT; Path=/; SameSite=None
Transfer-Encoding:
- chunked
permissions-policy:
- interest-cohort=()
x-api-pool:
- polite
x-rate-limit-interval:
- 1s
x-rate-limit-limit:
- "50"
x-ratelimit-interval:
- 1s
x-ratelimit-limit:
- "50"
status:
code: 200
message: OK
version: 1
15 changes: 9 additions & 6 deletions tests/test_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import logging
from collections.abc import Collection, Sequence
from pathlib import Path
from typing import Any, cast
from unittest.mock import patch

Expand Down Expand Up @@ -576,10 +577,10 @@ async def test_ensure_sequential_run_early_stop(

@pytest.mark.vcr
@pytest.mark.asyncio
async def test_crossref_retraction_status():
async def test_crossref_retraction_status(stub_data_dir: Path) -> None:
async with aiohttp.ClientSession() as session:
retract_processor = RetractionDataPostProcessor(
"stub_data/stub_retractions.csv"
f"{stub_data_dir}/stub_retractions.csv"
)
crossref_client = DocMetadataClient(
session,
Expand All @@ -594,7 +595,9 @@ async def test_crossref_retraction_status():
title="The Dilemma and Countermeasures of Music Education under the Background of Big Data",
fields=["title", "doi", "authors", "journal"],
)

assert "**RETRACTED ARTICLE** Citation: Jiaye Han." in crossref_details.formatted_citation # type: ignore[union-attr]

assert crossref_details.is_retracted is True, "Should be retracted" # type: ignore[union-attr]
assert crossref_details
assert (
"**RETRACTED ARTICLE** Citation: Jiaye Han."
in crossref_details.formatted_citation
)
assert crossref_details.is_retracted is True, "Should be retracted"

0 comments on commit 67b16c5

Please sign in to comment.