Skip to content

Commit f95a575

Browse files
Tests
1 parent a67ab83 commit f95a575

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

install/4_data_type.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,13 @@ INSERT INTO web.hierarchy_openatlas_class (hierarchy_id, openatlas_class_name) V
422422
INSERT INTO model.entity (name, cidoc_class_code, description, openatlas_class_name) VALUES
423423
('GeoNames', 'E32', 'Geographical database covering all countries and many places.', 'reference_system'),
424424
('Wikidata', 'E32', 'A free and open knowledge base and common source of open data providing persistent identifier and links to other sources.', 'reference_system'),
425-
('GND', 'E32', 'A collection of cultural and research authority data in the German-speaking countries.', 'reference_system');
425+
('GND', 'E32', 'A collection of cultural and research authority data in the German-speaking countries.', 'reference_system');
426426

427427
INSERT INTO web.reference_system (system, name, entity_id, resolver_url, website_url, identifier_example)
428428
VALUES
429429
(true, 'GeoNames', (SELECT id FROM model.entity WHERE name = 'GeoNames' AND cidoc_class_code = 'E32'), 'https://www.geonames.org/', 'https://www.geonames.org/', '1234567'),
430430
(true, 'Wikidata', (SELECT id FROM model.entity WHERE name = 'Wikidata' AND cidoc_class_code = 'E32'), 'https://www.wikidata.org/entity/', 'https://www.wikidata.org', 'Q123'),
431-
(true, 'GND', (SELECT id FROM model.entity WHERE name = 'GND' AND cidoc_class_code = 'E32'), 'https://gnd.network/', 'https://lobid.org/gnd/', '119338467');
431+
(true, 'GND', (SELECT id FROM model.entity WHERE name = 'GND' AND cidoc_class_code = 'E32'), 'https://lobid.org/gnd/', 'https://d-nb.info/gnd/','119338467');
432432

433433
INSERT INTO web.reference_system_openatlas_class (reference_system_id, openatlas_class_name) VALUES
434434
((SELECT entity_id FROM web.reference_system WHERE name='GeoNames'), 'place'),

install/upgrade/8.6.0.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ SELECT
2020
true,
2121
'GND',
2222
(SELECT id FROM model.entity WHERE name = 'GND' AND cidoc_class_code = 'E32'),
23-
'https://gnd.network/',
2423
'https://lobid.org/gnd/',
24+
'https://d-nb.info/gnd/',
2525
'119338467'
2626
WHERE NOT EXISTS (
2727
SELECT 1 FROM web.reference_system WHERE name='GND'

openatlas/api/external/wikidata.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77

88

99
def add_resolver_url(id_: str) -> str:
10-
return link(
11-
f'Q{id_}',
12-
f'{g.reference_systems[g.wikidata.id].resolver_url}Q{id_}',
13-
external=True)
10+
return link(f'Q{id_}', f'{g.wikidata.resolver_url}Q{id_}', external=True)
1411

1512

1613
def fetch_wikidata(id_: str) -> dict[str, Any]:

tests/test_index.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ def test_index(self) -> None:
4040
assert b'Database version error is needed but current' in rv.data
4141
assert b'directory not writable' in rv.data
4242

43-
rv = self.app.post(
44-
url_for('ajax_wikidata_info'),
45-
data={'id_': 'Q304037'})
46-
assert b'National Library of Austria' in rv.data
47-
48-
rv = self.app.post(
49-
url_for('ajax_geonames_info'),
50-
data={'id_': '747712'})
51-
assert b'Edirne' in rv.data
52-
5343
rv = self.app.get('/static/non_existing_file.js')
5444
assert b'The site does not exist.' in rv.data
5545

tests/test_reference_system.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ class ReferenceSystemTest(TestBaseCase):
1111
def test_reference_system(self) -> None:
1212
with app.app_context():
1313

14+
rv = self.app.post(
15+
url_for('ajax_wikidata_info'),
16+
data={'id_': 'Q304037'})
17+
assert b'National Library of Austria' in rv.data
18+
19+
rv = self.app.post(
20+
url_for('ajax_geonames_info'),
21+
data={'id_': '747712'})
22+
assert b'Edirne' in rv.data
23+
24+
rv = self.app.post(
25+
url_for('ajax_gnd_info'),
26+
data={'id_': '1158433263'})
27+
assert b'Abasgulijev' in rv.data
28+
1429
rv: Any = self.app.get(
1530
url_for('insert', class_='reference_system'))
1631
assert b'resolver URL' in rv.data
@@ -75,7 +90,9 @@ def test_reference_system(self) -> None:
7590
data={
7691
'name': 'Actor test',
7792
f'reference_system_id_{g.wikidata.id}':
78-
['Q123', self.precision_type.subs[0]]})
93+
['Q123', self.precision_type.subs[0]],
94+
f'reference_system_id_{g.gnd.id}':
95+
['1158433263', self.precision_type.subs[0]]})
7996
person_id = rv.location.split('/')[-1]
8097

8198
rv = self.app.get(url_for('view', id_=g.wikidata.id))

0 commit comments

Comments
 (0)