Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nomad-FAIR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
nomad-lab
nomad-FAIR
Commits
51a238e7
Commit
51a238e7
authored
5 years ago
by
Markus Scheidgen
Browse files
Options
Downloads
Patches
Plain Diff
Better raw query api test.
parent
e9e33ad7
No related branches found
No related tags found
1 merge request
!63
v0.6.2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/app/test_api.py
+11
-9
11 additions, 9 deletions
tests/app/test_api.py
with
11 additions
and
9 deletions
tests/app/test_api.py
+
11
−
9
View file @
51a238e7
...
...
@@ -1134,24 +1134,26 @@ class TestRaw(UploadFilesBasedTests):
assert
zip_file
.
testzip
()
is
None
assert
len
(
zip_file
.
namelist
())
==
0
@pytest.mark.parametrize
(
'
strip
'
,
[
False
,
True
])
def
test_raw_query_pattern
(
self
,
api
,
non_empty_processed
,
test_user_auth
,
strip
):
params
=
dict
(
file_pattern
=
'
*.json
'
)
@pytest.mark.parametrize
(
'
files, pattern, strip
'
,
[
(
1
,
'
*.json
'
,
False
),
(
1
,
'
*.json
'
,
True
),
(
5
,
[
'
*.json
'
,
'
*.aux
'
],
False
)])
def
test_raw_query_pattern
(
self
,
api
,
non_empty_processed
,
test_user_auth
,
files
,
pattern
,
strip
):
params
=
dict
(
file_pattern
=
pattern
)
if
strip
:
params
.
update
(
strip
=
True
)
url
=
'
/raw/query?%s
'
%
urlencode
(
params
)
url
=
'
/raw/query?%s
'
%
urlencode
(
params
,
doseq
=
True
)
rv
=
api
.
get
(
url
,
headers
=
test_user_auth
)
assert
rv
.
status_code
==
200
assert
len
(
rv
.
data
)
>
0
with
zipfile
.
ZipFile
(
io
.
BytesIO
(
rv
.
data
))
as
zip_file
:
assert
zip_file
.
testzip
()
is
None
files
=
zip_file
.
namelist
()
assert
len
(
files
)
==
1
assert
all
(
name
.
endswith
(
'
.json
'
)
for
name
in
files
)
zip_files
=
zip_file
.
namelist
()
assert
len
(
zip_files
)
==
files
if
strip
:
assert
all
(
os
.
path
.
basename
(
name
)
==
name
for
name
in
files
)
assert
all
(
os
.
path
.
basename
(
name
)
==
name
for
name
in
zip_
files
)
else
:
assert
all
(
os
.
path
.
basename
(
name
)
!=
name
for
name
in
files
)
assert
all
(
os
.
path
.
basename
(
name
)
!=
name
for
name
in
zip_
files
)
@UploadFilesBasedTests.ignore_authorization
def
test_raw_files_signed
(
self
,
api
,
upload
,
_
,
test_user_signature_token
):
...
...
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