Page MenuHomeSoftware Heritage

test_search.py
No OneTemporary

test_search.py

# Copyright (C) 2022 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from . import utils
def test_search_origins(client):
query_str = """
{
search(query: "fox", first: 1) {
nodes {
targetType
target {
...on Origin {
url
latestVisit {
date
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
"""
data, _ = utils.get_query_response(client, query_str)
assert len(data["search"]["nodes"]) == 1
assert data == {
"search": {
"nodes": [
{
"target": {
"url": "https://somewhere.org/den/fox",
"latestVisit": {"date": "2018-11-27T17:20:39+00:00"},
},
"targetType": "origin",
}
],
"pageInfo": {"endCursor": "MQ==", "hasNextPage": True},
}
}
def test_search_missing_url(client):
query_str = """
{
search(query: "missing-fox", first: 1) {
nodes {
targetType
}
pageInfo {
hasNextPage
endCursor
}
}
}
"""
data, _ = utils.get_query_response(client, query_str)
assert len(data["search"]["nodes"]) == 0

File Metadata

Mime Type
text/x-python
Expires
Jul 4 2025, 7:16 PM (6 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3433694

Event Timeline