Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre-Yves David
swh-web
Commits
f63ff1eb
Commit
f63ff1eb
authored
10 months ago
by
Antoine Lambert
Browse files
Options
Downloads
Patches
Plain Diff
test_metadata: Fix test that fails when using pytest-xdist
Set hypothesis max_examples to 1 and remove subtest fixture use.
parent
02dcef66
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/web/api/tests/views/test_metadata.py
+27
-30
27 additions, 30 deletions
swh/web/api/tests/views/test_metadata.py
with
27 additions
and
30 deletions
swh/web/api/tests/views/test_metadata.py
+
27
−
30
View file @
f63ff1eb
...
...
@@ -202,39 +202,36 @@ def test_api_raw_extrinsic_metadata_check_params(
check_api_get_responses
(
api_client
,
url
,
status_code
=
status_code
)
@settings
(
max_examples
=
1
)
@given
(
raw_extrinsic_metadata
())
def
test_api_raw_extrinsic_metadata_list_authorities
(
api_client
,
subtest
,
metadata
):
# ensure archive_data fixture will be reset between each hypothesis
# example test run
@subtest
def
test_inner
(
archive_data
):
archive_data
.
metadata_authority_add
([
metadata
.
authority
])
archive_data
.
metadata_fetcher_add
([
metadata
.
fetcher
])
archive_data
.
raw_extrinsic_metadata_add
([
metadata
])
def
test_api_raw_extrinsic_metadata_list_authorities
(
api_client
,
archive_data
,
metadata
):
archive_data
.
metadata_authority_add
([
metadata
.
authority
])
archive_data
.
metadata_fetcher_add
([
metadata
.
fetcher
])
archive_data
.
raw_extrinsic_metadata_add
([
metadata
])
authority
=
metadata
.
authority
url
=
reverse
(
"
api-1-raw-extrinsic-metadata-swhid-authorities
"
,
url_args
=
{
"
target
"
:
str
(
metadata
.
target
)},
)
rv
=
check_api_get_responses
(
api_client
,
url
,
status_code
=
200
)
authority
=
metadata
.
authority
url
=
reverse
(
"
api-1-raw-extrinsic-metadata-swhid-authorities
"
,
url_args
=
{
"
target
"
:
str
(
metadata
.
target
)},
)
rv
=
check_api_get_responses
(
api_client
,
url
,
status_code
=
200
)
expected_results
=
[
{
"
type
"
:
authority
.
type
.
value
,
"
url
"
:
authority
.
url
,
"
metadata_list_url
"
:
"
http://testserver
"
+
reverse
(
"
api-1-raw-extrinsic-metadata-swhid
"
,
url_args
=
{
"
target
"
:
str
(
metadata
.
target
)},
query_params
=
{
"
authority
"
:
f
"
{
authority
.
type
.
value
}
{
authority
.
url
}
"
},
),
}
]
expected_results
=
[
{
"
type
"
:
authority
.
type
.
value
,
"
url
"
:
authority
.
url
,
"
metadata_list_url
"
:
"
http://testserver
"
+
reverse
(
"
api-1-raw-extrinsic-metadata-swhid
"
,
url_args
=
{
"
target
"
:
str
(
metadata
.
target
)},
query_params
=
{
"
authority
"
:
f
"
{
authority
.
type
.
value
}
{
authority
.
url
}
"
},
),
}
]
assert
rv
.
data
==
expected_results
assert
rv
.
data
==
expected_results
def
test_api_raw_extrinsic_metadata_origin_redirect
(
api_client
,
archive_data
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment