Skip to content

Commit 246cf21

Browse files
author
notactuallyfinn
committed
renamed bad test domains
1 parent 0f6e0ec commit 246cf21

13 files changed

Lines changed: 85 additions & 82 deletions

File tree

docs/source/dev/data_model.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ provided as JSON-LD:
123123
:caption: Injecting additional schemas
124124
from hermes.model import SoftwareMetadata
125125
126-
# Contents served at https://bar.net/schema.jsonld:
126+
# Contents served at https://example.com/schema.jsonld:
127127
# {
128128
# "@context":
129129
# {
130130
# "name": "https://schema.org/name"
131131
# }
132132
# }
133133
134-
data = SoftwareMetadata(extra_vocabs={"foo": "https://bar.net/schema.jsonld"})
134+
data = SoftwareMetadata(extra_vocabs={"foo": "https://example.com/schema.jsonld"})
135135
136136
data["foo:name"] = ...
137137
```
@@ -197,16 +197,16 @@ data["author"] = {"name": "Shakespeare"}
197197
data["author"].append({"name": "Hamilton"})
198198
# [{'name': ['Shakespeare']}, {'name': ['Hamilton']}]
199199
200-
data["author"][0]["email"] = "shakespeare@baz.net"
201-
# [{'name': ['Shakespeare'], 'email': ['shakespeare@baz.net']}, {'name': ['Hamilton']}]
200+
data["author"][0]["email"] = "shakespeare@example.net"
201+
# [{'name': ['Shakespeare'], 'email': ['shakespeare@example.net']}, {'name': ['Hamilton']}]
202202
203-
data["author"][1]["email"].append("hamilton@baz.net")
204-
# [{'name': ['Shakespeare'], 'email': ['shakespeare@baz.net']}, {'name': ['Hamilton'], 'email': ['hamilton@baz.net']}]
203+
data["author"][1]["email"].append("hamilton@example.net")
204+
# [{'name': ['Shakespeare'], 'email': ['shakespeare@example.net']}, {'name': ['Hamilton'], 'email': ['hamilton@example.net']}]
205205
206-
data["author"][1]["email"].extend(["hamilton@spam.org", "hamilton@eggs.com"])
206+
data["author"][1]["email"].extend(["hamilton@example.org", "hamilton@example.com"])
207207
# [
208-
# {'name': ['Shakespeare'], 'email': ['shakespeare@baz.net']},
209-
# {'name': ['Hamilton'], 'email': ['hamilton@baz.net', 'hamilton@spam.org', 'hamilton@eggs.com']}
208+
# {'name': ['Shakespeare'], 'email': ['shakespeare@example.net']},
209+
# {'name': ['Hamilton'], 'email': ['hamilton@example.net', 'hamilton@example.org', 'hamilton@example.com']}
210210
# ]
211211
```
212212

@@ -257,7 +257,7 @@ Python data:
257257
:emphasize-lines: 5,13
258258
try:
259259
assert (
260-
{'name': ['Shakespeare'], 'email': ['shakespeare@baz.net']}
260+
{'name': ['Shakespeare'], 'email': ['shakespeare@example.net']}
261261
in
262262
data["author"]
263263
)
@@ -274,13 +274,13 @@ except AssertionError:
274274
# {'@list': [
275275
# {
276276
# 'http://schema.org/name': [{'@value': 'Shakespeare'}],
277-
# 'http://schema.org/email': [{'@value': 'shakespeare@baz.net'}]
277+
# 'http://schema.org/email': [{'@value': 'shakespeare@example.net'}]
278278
# },
279279
# {
280280
# 'http://schema.org/name': [{'@value': 'Hamilton'}],
281281
# 'http://schema.org/email': [
282282
# {'@list': [
283-
# {'@value': 'hamilton@baz.net'}, {'@value': 'hamilton@spam.org'}, {'@value': 'hamilton@eggs.com'}
283+
# {'@value': 'hamilton@example.net'}, {'@value': 'hamilton@example.org'}, {'@value': 'hamilton@example.com'}
284284
# ]}
285285
# ]
286286
# }]

src/hermes/model/hermes_cache.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class HermesCache:
1919
"""
2020
The HermesCache supplies the user with easy (read and write) access to the JSON files in the cache.
2121
22+
A HermesCache object should only be obtained from an HermesCacheManager object because this ensures the correct
23+
cache directory is used.
24+
2225
Attributes:
2326
_cache_dir (Path): The directory the cache is located at.
2427
_cached_data (dict[str, dict]): The cache of the files in the cache. The key is the filename.

test/hermes_test/commands/curate/test_do_nothing_curate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
{
3333
"@id": "_:author_1",
3434
"@type": ["http://schema.org/Person"],
35-
"http://schema.org/email": [{"@value": "test.testi@test.testi"}],
35+
"http://schema.org/email": [{"@value": "test.testi@example.com"}],
3636
"http://schema.org/familyName": [{"@value": "Testi"}],
3737
"http://schema.org/givenName": [{"@value": "Test"}]
3838
}
@@ -44,7 +44,7 @@
4444
{
4545
"@id": "_:contributor_1",
4646
"@type": ["http://schema.org/Person"],
47-
"http://schema.org/email": [{"@value": "test.testi@test.testi"}],
47+
"http://schema.org/email": [{"@value": "test.testi@example.com"}],
4848
"http://schema.org/familyName": [{"@value": "Testi"}],
4949
"http://schema.org/givenName": [{"@value": "Test"}]
5050
}

test/hermes_test/commands/deposit/test_invenio.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,36 +44,36 @@ def depositor():
4444

4545
@pytest.mark.skip(reason="pydantic-settings need to be refactored")
4646
def test_resolve_doi(requests_mock, resolver):
47-
requests_mock.get('https://doi.org/123.45/foo.bar-6789',
47+
requests_mock.get('https://doi.org/123.45/example.com-6789',
4848
status_code=302,
4949
headers={'Location': 'https://invenio.example.com/record/6789'})
5050
requests_mock.get('https://invenio.example.com/record/6789')
5151

52-
assert resolver.resolve_doi('123.45/foo.bar-6789') == '6789'
52+
assert resolver.resolve_doi('123.45/example.com-6789') == '6789'
5353

5454

5555
@pytest.mark.skip(reason="pydantic-settings need to be refactored")
5656
def test_resolve_doi_wrong_host(requests_mock, resolver):
57-
requests_mock.get('https://doi.org/123.45/foo.bar-6789',
57+
requests_mock.get('https://doi.org/123.45/example.com-6789',
5858
status_code=302,
5959
headers={'Location': 'https://not.invenio.example.com/record/6789'})
6060
requests_mock.get('https://not.invenio.example.com/record/6789')
6161

6262
with pytest.raises(ValueError):
63-
resolver.resolve_doi('123.45/foo.bar-6789')
63+
resolver.resolve_doi('123.45/example.com-6789')
6464

6565

6666
@pytest.mark.skip(reason="pydantic-settings need to be refactored")
6767
def test_resolve_doi_unknown(requests_mock, resolver):
68-
requests_mock.get('https://doi.org/123.45/foo.bar-6789',
68+
requests_mock.get('https://doi.org/123.45/example.com-6789',
6969
status_code=302,
7070
headers={'Location': 'https://datacite.org/404.html'})
7171

7272
# To show how broken datacite is right now
7373
requests_mock.get('https://datacite.org/404.html', status_code=200)
7474

7575
with pytest.raises(ValueError):
76-
resolver.resolve_doi('123.45/foo.bar-6789')
76+
resolver.resolve_doi('123.45/example.com-6789')
7777

7878

7979
@pytest.mark.skip(reason="pydantic-settings need to be refactored")

test/hermes_test/commands/harvest/test_harvest_cff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def test_cff_harvest(tmp_path, monkeypatch, cff, res):
152152
authors:
153153
- given-names: Test
154154
family-names: Testi
155-
email: test.testi@test.testi
155+
email: test.testi@example.com
156156
affiliation: German Aerospace Center (DLR)
157157
identifiers:
158158
- type: url
@@ -181,7 +181,7 @@ def test_cff_harvest(tmp_path, monkeypatch, cff, res):
181181
"http://schema.org/name": [{"@value": "German Aerospace Center (DLR)"}]
182182
}
183183
],
184-
"http://schema.org/email": [{"@value": "test.testi@test.testi"}],
184+
"http://schema.org/email": [{"@value": "test.testi@example.com"}],
185185
"http://schema.org/familyName": [{"@value": "Testi"}],
186186
"http://schema.org/givenName": [{"@value": "Test"}]
187187
}

test/hermes_test/commands/harvest/test_harvest_codemeta.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{
3838
"id": "_:author_1",
3939
"type": "Person",
40-
"email": "test.testi@test.testi",
40+
"email": "test.testi@example.com",
4141
"familyName": "Testi",
4242
"givenName": "Test"
4343
}
@@ -46,7 +46,7 @@
4646
"contributor": {
4747
"id": "_:contributor_1",
4848
"type": "Person",
49-
"email": "test.testi@test.testi",
49+
"email": "test.testi@example.com",
5050
"familyName": "Testi",
5151
"givenName": "Test"
5252
},
@@ -93,7 +93,7 @@
9393
{
9494
"@id": "_:author_1",
9595
"@type": ["http://schema.org/Person"],
96-
"http://schema.org/email": [{"@value": "test.testi@test.testi"}],
96+
"http://schema.org/email": [{"@value": "test.testi@example.com"}],
9797
"http://schema.org/familyName": [{"@value": "Testi"}],
9898
"http://schema.org/givenName": [{"@value": "Test"}]
9999
}
@@ -105,7 +105,7 @@
105105
{
106106
"@id": "_:contributor_1",
107107
"@type": ["http://schema.org/Person"],
108-
"http://schema.org/email": [{"@value": "test.testi@test.testi"}],
108+
"http://schema.org/email": [{"@value": "test.testi@example.com"}],
109109
"http://schema.org/familyName": [{"@value": "Testi"}],
110110
"http://schema.org/givenName": [{"@value": "Test"}]
111111
}

test/hermes_test/commands/process/test_process.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def test_process(tmp_path, monkeypatch, metadata_in, metadata_out):
250250
{
251251
"@type": "http://schema.org/Person",
252252
"http://schema.org/familyName": [{"@value": "Test"}],
253-
"http://schema.org/email": [{"@value": "test.testi@testis.tests"}],
253+
"http://schema.org/email": [{"@value": "test.testi@example.com"}],
254254
},
255255
{
256256
"@type": "http://schema.org/Person",
@@ -259,7 +259,7 @@ def test_process(tmp_path, monkeypatch, metadata_in, metadata_out):
259259
{
260260
"@type": "http://schema.org/Person",
261261
"http://schema.org/familyName": [{"@value": "Tester"}],
262-
"http://schema.org/email": [{"@value": "test@tester.tests"}],
262+
"http://schema.org/email": [{"@value": "test@example.net"}],
263263
},
264264
],
265265
"http://schema.org/license": [{"@id": "https://spdx.org/licenses/Apache-2.0"}],
@@ -276,8 +276,8 @@ def test_process(tmp_path, monkeypatch, metadata_in, metadata_out):
276276
"http://schema.org/familyName": [{"@value": "Test"}],
277277
"http://schema.org/givenName": [{"@value": "Testi"}],
278278
"http://schema.org/email": [
279-
{"@value": "test.testi@testis.tests"},
280-
{"@value": "test.testi@testis.tests2"},
279+
{"@value": "test.testi@example.com"},
280+
{"@value": "test.testi@example.edu"},
281281
],
282282
},
283283
{
@@ -299,15 +299,15 @@ def test_process(tmp_path, monkeypatch, metadata_in, metadata_out):
299299
"http://schema.org/familyName": [{"@value": "Test"}],
300300
"http://schema.org/givenName": [{"@value": "Testi"}],
301301
"http://schema.org/email": [
302-
{"@value": "test.testi@testis.tests"},
303-
{"@value": "test.testi@testis.tests2"},
302+
{"@value": "test.testi@example.com"},
303+
{"@value": "test.testi@example.edu"},
304304
],
305305
},
306306
{"@type": "http://schema.org/Person", "http://schema.org/familyName": [{"@value": "Testers"}]},
307307
{
308308
"@type": "http://schema.org/Person",
309309
"http://schema.org/familyName": [{"@value": "Tester"}],
310-
"http://schema.org/email": [{"@value": "test@tester.tests"}],
310+
"http://schema.org/email": [{"@value": "test@example.net"}],
311311
},
312312
],
313313
"http://schema.org/license": [{"@id": "https://spdx.org/licenses/Apache-2.0"}],
@@ -327,12 +327,12 @@ def test_process(tmp_path, monkeypatch, metadata_in, metadata_out):
327327
{
328328
"@type": "http://schema.org/Person",
329329
"http://schema.org/familyName": [{"@value": "Tester"}],
330-
"http://schema.org/email": [{"@value": "test@tester.tests"}],
330+
"http://schema.org/email": [{"@value": "test@example.net"}],
331331
},
332332
{
333333
"@type": "http://schema.org/Person",
334334
"http://schema.org/familyName": [{"@value": "Testis"}],
335-
"http://schema.org/email": [{"@value": "testis.testis@tester.tests"}],
335+
"http://schema.org/email": [{"@value": "testis.testis@example.net"}],
336336
},
337337
],
338338
}
@@ -345,7 +345,7 @@ def test_process(tmp_path, monkeypatch, metadata_in, metadata_out):
345345
{
346346
"@type": "http://schema.org/Person",
347347
"http://schema.org/familyName": [{"@value": "Test"}],
348-
"http://schema.org/email": [{"@value": "test.testi@testis.tests"}],
348+
"http://schema.org/email": [{"@value": "test.testi@example.com"}],
349349
},
350350
{
351351
"@type": "http://schema.org/Person",
@@ -354,7 +354,7 @@ def test_process(tmp_path, monkeypatch, metadata_in, metadata_out):
354354
{
355355
"@type": "http://schema.org/Person",
356356
"http://schema.org/familyName": [{"@value": "Tester"}],
357-
"http://schema.org/email": [{"@value": "test@tester.tests"}],
357+
"http://schema.org/email": [{"@value": "test@example.net"}],
358358
},
359359
],
360360
"http://schema.org/license": [{"@id": "https://spdx.org/licenses/Apache-2.0"}],
@@ -371,8 +371,8 @@ def test_process(tmp_path, monkeypatch, metadata_in, metadata_out):
371371
"http://schema.org/familyName": [{"@value": "Test"}],
372372
"http://schema.org/givenName": [{"@value": "Testi"}],
373373
"http://schema.org/email": [
374-
{"@value": "test.testi@testis.tests"},
375-
{"@value": "test.testi@testis.tests2"},
374+
{"@value": "test.testi@example.com"},
375+
{"@value": "test.testi@example.edu"},
376376
],
377377
},
378378
{
@@ -394,20 +394,20 @@ def test_process(tmp_path, monkeypatch, metadata_in, metadata_out):
394394
"http://schema.org/familyName": [{"@value": "Test"}],
395395
"http://schema.org/givenName": [{"@value": "Testi"}],
396396
"http://schema.org/email": [
397-
{"@value": "test.testi@testis.tests"},
398-
{"@value": "test.testi@testis.tests2"},
397+
{"@value": "test.testi@example.com"},
398+
{"@value": "test.testi@example.edu"},
399399
],
400400
},
401401
{"@type": "http://schema.org/Person", "http://schema.org/familyName": [{"@value": "Testers"}]},
402402
{
403403
"@type": "http://schema.org/Person",
404404
"http://schema.org/familyName": [{"@value": "Tester"}],
405-
"http://schema.org/email": [{"@value": "test@tester.tests"}],
405+
"http://schema.org/email": [{"@value": "test@example.net"}],
406406
},
407407
{
408408
"@type": "http://schema.org/Person",
409409
"http://schema.org/familyName": [{"@value": "Testis"}],
410-
"http://schema.org/email": [{"@value": "testis.testis@tester.tests"}],
410+
"http://schema.org/email": [{"@value": "testis.testis@example.net"}],
411411
},
412412
],
413413
"http://schema.org/license": [{"@id": "https://spdx.org/licenses/Apache-2.0"}],

test/hermes_test/model/test_api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from hermes.model.types.ld_context import ALL_CONTEXTS
1414

15-
EXTRA_VOCABS = {"foo": "https://bar.net/schema"}
15+
EXTRA_VOCABS = {"foo": "https://example.net/schema"}
1616

1717

1818
@pytest.fixture
@@ -50,7 +50,7 @@ def test_init_nested_object():
5050
"maintainer": {"name": "Some Name", "email": "maintainer@example.com"},
5151
"author": [{"name": "Foo"}, {"name": "Bar"}],
5252
}
53-
data = SoftwareMetadata(my_software, extra_vocabs={"foo": "https://foo.bar"})
53+
data = SoftwareMetadata(my_software, extra_vocabs={"foo": "https://example.com"})
5454
assert data["schema:softwareName"] == ["MySoftware"]
5555
assert len(data["maintainer"]) == 1 and data["maintainer"][0]["name"] == ["Some Name"]
5656
for author in data["author"]:
@@ -83,7 +83,7 @@ def test_append():
8383

8484
def test_iterative_assignment():
8585
# This tests iterative assignments/traversals to edit/appending values
86-
data = SoftwareMetadata(extra_vocabs={"foo": "https://foo.bar"})
86+
data = SoftwareMetadata(extra_vocabs={"foo": "https://example.com"})
8787
data["author"] = {"name": "Foo"}
8888
# Look, a squirrel!
8989
authors = data["author"]
@@ -100,8 +100,8 @@ def test_usage():
100100
data = SoftwareMetadata()
101101
data["author"] = {"name": "Foo"}
102102
data["author"].append({"name": "Bar"})
103-
data["author"][0]["email"] = "foo@bar.net"
104-
data["author"][0]["email"].append("foo@baz.com")
103+
data["author"][0]["email"] = "foo@example.net"
104+
data["author"][0]["email"].append("foo@example.org")
105105
assert len(data["author"]) == 2
106106
assert len(data["author"][0]["email"]) == 2
107107
assert len(data["author"][1].get("email", [])) == 0
@@ -130,7 +130,7 @@ def test_usage():
130130
assert foo["name"][0] == "Foo"
131131
assert foo["affiliation"] == ["Uni A", "Lab B"]
132132
assert foo["schema:knowsAbout"] == ["a", "b", "c"]
133-
assert foo["email"] == ["foo@bar.net", "foo@baz.com"]
133+
assert foo["email"] == ["foo@example.net", "foo@example.org"]
134134
assert bar["name"][0] == "Bar"
135135
assert bar["affiliation"] == ["Uni C"]
136136
assert bar["email"] == ["bar@c.edu"]

test/hermes_test/model/types/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MockDocument:
1313
"""
1414

1515
@classmethod
16-
def vocabulary(cls, base_url: str = "http://spam.eggs/") -> dict:
16+
def vocabulary(cls, base_url: str = "http://example.com/") -> dict:
1717
"""
1818
Retrieve the vocabulary used for the document.
1919
@@ -31,7 +31,7 @@ def vocabulary(cls, base_url: str = "http://spam.eggs/") -> dict:
3131
}
3232

3333
@classmethod
34-
def compact(cls, base_url: str = "http://spam.eggs/", embed_vocabulary: bool = True) -> dict:
34+
def compact(cls, base_url: str = "http://example.com/", embed_vocabulary: bool = True) -> dict:
3535
"""
3636
Get compact representation of the example document.
3737
@@ -52,7 +52,7 @@ def compact(cls, base_url: str = "http://spam.eggs/", embed_vocabulary: bool = T
5252
}
5353

5454
@classmethod
55-
def expanded(cls, base_url: str = "http://spam.eggs/") -> list[dict]:
55+
def expanded(cls, base_url: str = "http://example.com/") -> list[dict]:
5656
"""
5757
Get expanded representation of the example document.
5858

0 commit comments

Comments
 (0)