-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtest_download.py
More file actions
37 lines (29 loc) · 1021 Bytes
/
test_download.py
File metadata and controls
37 lines (29 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Download Tests"""
<<<<<<< HEAD
import databusclient.client as cl
=======
>>>>>>> main
import pytest
from databusclient.api.download import download as api_download
# TODO: overall test structure not great, needs refactoring
DEFAULT_ENDPOINT = "https://databus.dbpedia.org/sparql"
TEST_QUERY = """
PREFIX dcat: <http://www.w3.org/ns/dcat#>
SELECT ?file
WHERE {
?file dcat:downloadURL ?url ;
dcat:byteSize ?size .
FILTER(STRSTARTS(STR(?file), "https://databus.dbpedia.org/dbpedia/"))
FILTER(xsd:integer(?size) < 104857600)
}
LIMIT 10
"""
TEST_COLLECTION = (
"https://databus.dbpedia.org/dbpedia/collections/dbpedia-snapshot-2022-12"
)
def test_with_query():
api_download("tmp", DEFAULT_ENDPOINT, [TEST_QUERY])
@pytest.mark.skip(reason="Live collection download is long-running and flakes on network timeouts")
@pytest.mark.skip(reason="Integration test: requires live databus.dbpedia.org connection")
def test_with_collection():
api_download("tmp", DEFAULT_ENDPOINT, [TEST_COLLECTION])