Skip to content

Commit 070bbf6

Browse files
committed
test: add respx mock route for /repository{id} endpoint (#114)
Fixes #112
1 parent 15668bc commit 070bbf6

File tree

5 files changed

+198
-108
lines changed

5 files changed

+198
-108
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ repos:
9292
hooks:
9393
- id: typos
9494
args: [--force-exclude]
95+
exclude: tests/conftest
9596

9697
- repo: https://github.com/FHPythonUtils/LicenseCheck/
9798
rev: b2b50f4d40c95b15478279a7a00553a1dc2925ef # frozen: 2024.2

tests/cassettes/repository.yaml

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,4 @@
11
interactions:
2-
- request:
3-
body: ''
4-
headers:
5-
accept:
6-
- text/xml; charset=utf-8
7-
accept-encoding:
8-
- gzip, deflate
9-
connection:
10-
- keep-alive
11-
host:
12-
- www.re3data.org
13-
user-agent:
14-
- python-re3data/0.1.0
15-
method: GET
16-
uri: https://www.re3data.org/api/beta/repository/r3d100010468
17-
response:
18-
body:
19-
string: !!binary |
20-
H4sIAAAAAAAAA+UaXW/bOPK9wP4Hnh8Ou0D0YcdJ21zrvZzjbgOkSeC0i8O9FIw0tnmRRC1JxXH/
21-
0f6O/WM3Q1GWbMtJ2jh36O1DEIvzyeHMcEjOm5/v0oTdgtJCZm87XT/sMMgiGYts+rZTmIn3qvPz
22-
4MWbv3iegv2YG+5LNWVX0QxSziZSMTMDdgI6UiI3yIPJCRuDBq6iGTtBfPzKpRZGKgHaZ7+WoljP
23-
7+0hXQTpNSjWC7t9n8VSHHVDv7ff7QUozQ/DQ89D4Wo/PnLSGaqb6SMceduZGZMfBcF8PvcbugXa
24-
6hb0vF7HYd9psYI937eIvTDsBv/8cFZOxhOZNjyLAKm0OCq5nMmIG2uZB4Uxh1GOrCAhNHDfv+Jv
25-
/07HncELxtzEnHkWNLQcXFKfxpAZMRGgBgjphqh02D989SbYjtfkUzE/5ymwhG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8b52z3uswuGONX4okp5nHo1bzG+ayUMp/ls0
53-
/5Qnksct8kvAVg9vgLfRPuzlm3hrOje1W+O+3eQr8JZNtR3nAT5fuw4bxK0z21wTLSdmztW6PtXw
54-
uh+tjDdErLKxLFwLEpbAg0VlisZYjchzwfCP1vZt5+L41Lv88L7T9hwsueg5l0D8bRzGo6uPNXkM
55-
t5BQO4befLJbZZKL+GqhDaSDk4tTVw4shxoPCMJYr/qlEDHQU/oj3gZbaRrqL8VcjIenJ065FtmQ
56-
zaifKb6s+zVq27YBa9LfCk416Qee4YGK3nLwgFDSbUIa76BgOHlP9SBUeUkr0J7Z1geXj7DDYWdA
57-
3WNDYYB9cFiu7cy9oLbwu1dgZXlXOsdR5PPIL27oMs0+h+mgIvG0o9EBfeKCgFfD7lFiLZTaDfIs
58-
tqJlpAvq6t7pv2UeK9eLtsp9vEUUWlXdaNeVxoRmkcQMUDa1fJzJVMsMj+0FluW67CwcukDB830M
59-
dz5zlFj8a3acGJSFiZuV/8oeBffSpplIczwQMer7oCdVYkLvwTN7OZDaHhyXo1gVjpr92D3ww67f
60-
w6PpT6vSRHYLmZB1L9NiSe+z6nqDXagcg44uC6WK677IBZtKwzg17oBHU7aqzjk1OHnXCj/QBvhV
61-
dj+tCj69T7BrlyJOCS8y9BdkK8zMzbTSK08KXfVLkZyqiYsvG3s82/Sk6iuT5nWKjws44nrBCrtp
62-
lC/XkAqPF0aSbaOl61I7V56ANTcuqmvuKrOP1axuQJIZZb6q800zXaBgVO4ENfqHvLN3OKXAPcwP
63-
aKIEFoFNiMGQOqrGMAmWhq+RnReANxFJQnIq1fzqTF46YTOLGrVotOIcet39KoVWkBo7Qbt8sn0/
64-
g7rrp0RvgF5U4dBs/qxGbEfn4D9yCaEjmSsAAA==
65-
headers:
66-
Cache-Control:
67-
- no-cache, private
68-
Connection:
69-
- Keep-Alive
70-
Content-Encoding:
71-
- gzip
72-
Content-Length:
73-
- '2536'
74-
Content-Type:
75-
- text/xml; charset=UTF-8
76-
Date:
77-
- Tue, 21 May 2024 13:55:12 GMT
78-
Keep-Alive:
79-
- timeout=5, max=100
80-
Link:
81-
- /api/beta/repositories; rel="index"
82-
Server:
83-
- Apache/2.4.41 (Ubuntu)
84-
Vary:
85-
- Accept-Encoding
86-
status:
87-
code: 200
88-
message: OK
892
- request:
903
body: ''
914
headers:

tests/conftest.py

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,187 @@ def mock_repository_list_route(respx_mock: MockRouter) -> Route:
6060
return respx_mock.get("https://www.re3data.org/api/beta/repositories").mock(
6161
return_value=httpx.Response(httpx.codes.OK, text=REPOSITORY_LIST_XML)
6262
)
63+
64+
65+
REPOSITORY_GET_XML: str = """<?xml version="1.0" encoding="utf-8"?>
66+
<!--re3data.org Schema for the Description of Research
67+
Data Repositories. Version 2.2, December 2014. doi:10.2312/re3.006-->
68+
<r3d:re3data xmlns:r3d="http://www.re3data.org/schema/2-2"
69+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
70+
xsi:schemaLocation="http://www.re3data.org/schema/2-2 http://schema.re3data.org/2-2/re3dataV2-2.xsd">
71+
<r3d:repository>
72+
<r3d:re3data.orgIdentifier>r3d100010468</r3d:re3data.orgIdentifier>
73+
<r3d:repositoryName language="eng">Zenodo</r3d:repositoryName>
74+
<r3d:repositoryURL>https://zenodo.org/</r3d:repositoryURL>
75+
<r3d:repositoryIdentifier>FAIRsharing_doi:10.25504/FAIRsharing.wy4egf</r3d:repositoryIdentifier>
76+
<r3d:repositoryIdentifier>RRID:SCR_004129</r3d:repositoryIdentifier>
77+
<r3d:repositoryIdentifier>RRID:nlx_158614</r3d:repositoryIdentifier>
78+
<r3d:description language="eng">ZENODO builds and operates a simple and innovative service that
79+
enables researchers, scientists, EU projects and institutions to share and showcase
80+
multidisciplinary research results (data and publications) that are not part of the existing
81+
institutional or subject-based repositories of the research communities.
82+
ZENODO enables researchers, scientists, EU projects and institutions to:
83+
easily share the long tail of small research results in a wide variety of formats including
84+
text, spreadsheets, audio, video, and images across all fields of science.
85+
display their research results and get credited by making the research results citable and
86+
integrate them into existing reporting lines to funding agencies like the European Commission.
87+
easily access and reuse shared research results.</r3d:description>
88+
<r3d:repositoryContact>https://zenodo.org/contact</r3d:repositoryContact>
89+
<r3d:repositoryContact>info@zenodo.org</r3d:repositoryContact>
90+
<r3d:type>other</r3d:type>
91+
<r3d:size updated="2023-04-26">2.916.709 results</r3d:size>
92+
<r3d:startDate>2013-05-08</r3d:startDate>
93+
<r3d:endDate></r3d:endDate>
94+
<r3d:repositoryLanguage>eng</r3d:repositoryLanguage>
95+
<r3d:subject subjectScheme="DFG">1 Humanities and Social Sciences</r3d:subject>
96+
<r3d:subject subjectScheme="DFG">2 Life Sciences</r3d:subject>
97+
<r3d:subject subjectScheme="DFG">3 Natural Sciences</r3d:subject>
98+
<r3d:subject subjectScheme="DFG">4 Engineering Sciences</r3d:subject>
99+
<r3d:missionStatementURL>https://about.zenodo.org/</r3d:missionStatementURL>
100+
<r3d:contentType contentTypeScheme="parse">Archived data</r3d:contentType>
101+
<r3d:contentType contentTypeScheme="parse">Audiovisual data</r3d:contentType>
102+
<r3d:contentType contentTypeScheme="parse">Images</r3d:contentType>
103+
<r3d:contentType contentTypeScheme="parse">Networkbased data</r3d:contentType>
104+
<r3d:contentType contentTypeScheme="parse">Plain text</r3d:contentType>
105+
<r3d:contentType contentTypeScheme="parse">Raw data</r3d:contentType>
106+
<r3d:contentType contentTypeScheme="parse">Scientific and statistical data formats</r3d:contentType>
107+
<r3d:contentType contentTypeScheme="parse">Source code</r3d:contentType>
108+
<r3d:contentType contentTypeScheme="parse">Standard office documents</r3d:contentType>
109+
<r3d:contentType contentTypeScheme="parse">Structured graphics</r3d:contentType>
110+
<r3d:contentType contentTypeScheme="parse">Structured text</r3d:contentType>
111+
<r3d:contentType contentTypeScheme="parse">other</r3d:contentType>
112+
<r3d:providerType>dataProvider</r3d:providerType>
113+
<r3d:keyword>FAIR</r3d:keyword>
114+
<r3d:keyword>multidisciplinary</r3d:keyword>
115+
<r3d:institution>
116+
<r3d:institutionName language="eng">European Commission, Horizon 2020</r3d:institutionName>
117+
<r3d:institutionCountry>EEC</r3d:institutionCountry>
118+
<r3d:responsibilityType>funding</r3d:responsibilityType>
119+
<r3d:institutionType>non-profit</r3d:institutionType>
120+
<r3d:institutionURL>
121+
https://research-and-innovation.ec.europa.eu/funding/funding-opportunities/funding-programmes-and-open-calls/horizon-2020_en</r3d:institutionURL>
122+
<r3d:responsibilityStartDate>2014</r3d:responsibilityStartDate>
123+
<r3d:responsibilityEndDate>2020</r3d:responsibilityEndDate>
124+
<r3d:institutionContact>https://research-and-innovation.ec.europa.eu/contact-us_en</r3d:institutionContact>
125+
</r3d:institution>
126+
<r3d:institution>
127+
<r3d:institutionName language="eng">European Commission, Research &amp; Innovation, Seventh Framework Programm - FP7</r3d:institutionName>
128+
<r3d:institutionAdditionalName language="eng">FP7</r3d:institutionAdditionalName>
129+
<r3d:institutionCountry>EEC</r3d:institutionCountry>
130+
<r3d:responsibilityType>funding</r3d:responsibilityType>
131+
<r3d:institutionType>non-profit</r3d:institutionType>
132+
<r3d:institutionURL>https://commission.europa.eu/research-and-innovation_en</r3d:institutionURL>
133+
<r3d:responsibilityStartDate></r3d:responsibilityStartDate>
134+
<r3d:responsibilityEndDate></r3d:responsibilityEndDate>
135+
<r3d:institutionContact>https://research-and-innovation.ec.europa.eu/contact-us_en</r3d:institutionContact>
136+
</r3d:institution>
137+
<r3d:institution>
138+
<r3d:institutionName language="eng">European Organization for Nuclear Research</r3d:institutionName>
139+
<r3d:institutionAdditionalName language="fra">CERN</r3d:institutionAdditionalName>
140+
<r3d:institutionAdditionalName language="fra">Centre Européen pour la Recherche Nucléaire</r3d:institutionAdditionalName>
141+
<r3d:institutionCountry>EEC</r3d:institutionCountry>
142+
<r3d:responsibilityType>funding</r3d:responsibilityType>
143+
<r3d:responsibilityType>general</r3d:responsibilityType>
144+
<r3d:responsibilityType>technical</r3d:responsibilityType>
145+
<r3d:institutionType>non-profit</r3d:institutionType>
146+
<r3d:institutionURL>https://home.cern/</r3d:institutionURL>
147+
<r3d:institutionIdentifier>ROR:01ggx4157</r3d:institutionIdentifier>
148+
<r3d:responsibilityStartDate></r3d:responsibilityStartDate>
149+
<r3d:responsibilityEndDate></r3d:responsibilityEndDate>
150+
<r3d:institutionContact>https://about.zenodo.org/contact/</r3d:institutionContact>
151+
</r3d:institution>
152+
<r3d:institution>
153+
<r3d:institutionName language="eng">OpenAIRE</r3d:institutionName>
154+
<r3d:institutionAdditionalName language="eng">Open Access Infrastructure for Research in Europa</r3d:institutionAdditionalName>
155+
<r3d:institutionCountry>EEC</r3d:institutionCountry>
156+
<r3d:responsibilityType>funding</r3d:responsibilityType>
157+
<r3d:responsibilityType>general</r3d:responsibilityType>
158+
<r3d:institutionType>non-profit</r3d:institutionType>
159+
<r3d:institutionURL>https://www.openaire.eu/</r3d:institutionURL>
160+
<r3d:institutionIdentifier>ROR:019kf3481</r3d:institutionIdentifier>
161+
<r3d:institutionIdentifier>RRID:SCR_013740</r3d:institutionIdentifier>
162+
<r3d:responsibilityStartDate></r3d:responsibilityStartDate>
163+
<r3d:responsibilityEndDate></r3d:responsibilityEndDate>
164+
<r3d:institutionContact>https://www.openaire.eu/contact-us</r3d:institutionContact>
165+
</r3d:institution>
166+
<r3d:policy>
167+
<r3d:policyName>Policies</r3d:policyName>
168+
<r3d:policyURL>https://about.zenodo.org/policies/</r3d:policyURL>
169+
</r3d:policy>
170+
<r3d:policy>
171+
<r3d:policyName>Terms of use</r3d:policyName>
172+
<r3d:policyURL>https://about.zenodo.org/terms/</r3d:policyURL>
173+
</r3d:policy>
174+
<r3d:databaseAccess>
175+
<r3d:databaseAccessType>open</r3d:databaseAccessType>
176+
</r3d:databaseAccess>
177+
<r3d:databaseLicense>
178+
<r3d:databaseLicenseName>CC0</r3d:databaseLicenseName>
179+
<r3d:databaseLicenseURL>https://creativecommons.org/publicdomain/zero/1.0/</r3d:databaseLicenseURL>
180+
</r3d:databaseLicense>
181+
<r3d:dataAccess>
182+
<r3d:dataAccessType>closed</r3d:dataAccessType>
183+
</r3d:dataAccess>
184+
<r3d:dataAccess>
185+
<r3d:dataAccessType>embargoed</r3d:dataAccessType>
186+
</r3d:dataAccess>
187+
<r3d:dataAccess>
188+
<r3d:dataAccessType>open</r3d:dataAccessType>
189+
</r3d:dataAccess>
190+
<r3d:dataAccess>
191+
<r3d:dataAccessType>restricted</r3d:dataAccessType>
192+
<r3d:dataAccessRestriction>registration</r3d:dataAccessRestriction>
193+
</r3d:dataAccess>
194+
<r3d:dataLicense>
195+
<r3d:dataLicenseName>CC</r3d:dataLicenseName>
196+
<r3d:dataLicenseURL>https://creativecommons.org/</r3d:dataLicenseURL>
197+
</r3d:dataLicense>
198+
<r3d:dataLicense>
199+
<r3d:dataLicenseName>CC0</r3d:dataLicenseName>
200+
<r3d:dataLicenseURL>https://creativecommons.org/publicdomain/zero/1.0/</r3d:dataLicenseURL>
201+
</r3d:dataLicense>
202+
<r3d:dataLicense>
203+
<r3d:dataLicenseName>other</r3d:dataLicenseName>
204+
<r3d:dataLicenseURL>https://about.zenodo.org/policies/</r3d:dataLicenseURL>
205+
</r3d:dataLicense>
206+
<r3d:dataUpload>
207+
<r3d:dataUploadType>restricted</r3d:dataUploadType>
208+
<r3d:dataUploadRestriction>registration</r3d:dataUploadRestriction>
209+
</r3d:dataUpload>
210+
<r3d:dataUploadLicense>
211+
<r3d:dataUploadLicenseName>Policies</r3d:dataUploadLicenseName>
212+
<r3d:dataUploadLicenseURL>https://about.zenodo.org/policies/</r3d:dataUploadLicenseURL>
213+
</r3d:dataUploadLicense>
214+
<r3d:software>
215+
<r3d:softwareName>other</r3d:softwareName>
216+
</r3d:software>
217+
<r3d:versioning>yes</r3d:versioning>
218+
<r3d:api apiType="OAI-PMH">https://zenodo.org/oai2d</r3d:api>
219+
<r3d:api apiType="REST">https://developers.zenodo.org/</r3d:api>
220+
<r3d:pidSystem>DOI</r3d:pidSystem>
221+
<r3d:citationGuidelineURL>https://about.zenodo.org/</r3d:citationGuidelineURL>
222+
<r3d:aidSystem>ORCID</r3d:aidSystem>
223+
<r3d:enhancedPublication>yes</r3d:enhancedPublication>
224+
<r3d:qualityManagement>no</r3d:qualityManagement>
225+
<r3d:metadataStandard>
226+
<r3d:metadataStandardName metadataStandardScheme="DCC">DataCite Metadata Schema</r3d:metadataStandardName>
227+
<r3d:metadataStandardURL>
228+
http://www.dcc.ac.uk/resources/metadata-standards/datacite-metadata-schema</r3d:metadataStandardURL>
229+
</r3d:metadataStandard>
230+
<r3d:metadataStandard>
231+
<r3d:metadataStandardName metadataStandardScheme="DCC">Dublin Core</r3d:metadataStandardName>
232+
<r3d:metadataStandardURL>http://www.dcc.ac.uk/resources/metadata-standards/dublin-core</r3d:metadataStandardURL>
233+
</r3d:metadataStandard>
234+
<r3d:remarks>Zenodo is covered by Thomson Reuters Data Citation Index. Zenodo uses Altmetric metrics and provides impact information in the form of software citations (15.01.2019). Zenodo uses invenio repository software. OpenAIRE Orphan Record Repository got a make-over and was re-branded as ZENODO. Zenodo uses Invenio repository software. ZENODO was launched within the OpenAIREplus project as part of a European-wide research infrastructure. Easy upload and semi-automatic metadata completion by communication with existing online services such as DropBox for upload, Mendeley/ORCID/CrossRef/OpenAIRE for upload and pre-filling metadata.</r3d:remarks>
235+
<r3d:entryDate>2013-06-13</r3d:entryDate>
236+
<r3d:lastUpdate>2023-04-26</r3d:lastUpdate>
237+
</r3d:repository>
238+
</r3d:re3data>
239+
"""
240+
241+
242+
@pytest.fixture()
243+
def mock_repository_get_route(respx_mock: MockRouter) -> Route:
244+
return respx_mock.get("https://www.re3data.org/api/beta/repository/r3d100010468").mock(
245+
return_value=httpx.Response(httpx.codes.OK, text=REPOSITORY_GET_XML)
246+
)

tests/integration/test_cli.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,34 +99,28 @@ def test_repository_get_without_repository_id(mock_repository_list_route: Route)
9999
assert "Missing argument" in result.output
100100

101101

102-
@pytest.mark.default_cassette("repository.yaml")
103-
@pytest.mark.vcr()
104-
def test_repository_get_with_repository_id_default_return_type(zenodo_id: str) -> None:
102+
def test_repository_get_with_repository_id_default_return_type(
103+
mock_repository_get_route: Route, zenodo_id: str
104+
) -> None:
105105
result = runner.invoke(app, ["repository", "get", zenodo_id])
106106
assert result.exit_code == 0
107107
assert "<r3d:repository>" in result.output
108108
assert "<r3d:re3data.orgIdentifier>r3d100010468" in result.output
109109

110110

111-
@pytest.mark.default_cassette("repository.yaml")
112-
@pytest.mark.vcr()
113-
def test_repository_get_with_repository_id_xml(zenodo_id: str) -> None:
111+
def test_repository_get_with_repository_id_xml(mock_repository_get_route: Route, zenodo_id: str) -> None:
114112
result = runner.invoke(app, ["repository", "get", zenodo_id, "--return-type", "xml"])
115113
assert result.exit_code == 0
116114
assert "<r3d:repository>" in result.output
117115
assert "<r3d:re3data.orgIdentifier>r3d100010468" in result.output
118116

119117

120-
@pytest.mark.default_cassette("repository.yaml")
121-
@pytest.mark.vcr()
122-
def test_repository_get_with_repository_id_response(zenodo_id: str) -> None:
118+
def test_repository_get_with_repository_id_response(mock_repository_get_route: Route, zenodo_id: str) -> None:
123119
result = runner.invoke(app, ["repository", "get", zenodo_id, "--return-type", "response"])
124120
assert result.exit_code == 0
125121
assert "<Response [200 OK]>" in result.output
126122

127123

128-
@pytest.mark.default_cassette("repository.yaml")
129-
@pytest.mark.vcr()
130124
def test_repository_get_with_repository_id_invalid_return_type(zenodo_id: str) -> None:
131125
result = runner.invoke(app, ["repository", "get", zenodo_id, "--return-type", "json"])
132126
assert result.exit_code == 2

0 commit comments

Comments
 (0)