Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9349315
test_search.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
test_search.py
View Options
# 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
Details
Attached
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
Attached To
rDGQL GraphQL API
Event Timeline
Log In to Comment