Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tests_api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
hive
tests_api
Commits
1ae2a4b1
Commit
1ae2a4b1
authored
4 years ago
by
Dariusz Kędzierski
Browse files
Options
Downloads
Patches
Plain Diff
Only pattern check is disabled, other checks are valid
parent
820b1f1d
No related branches found
No related tags found
1 merge request
!169
Validator with ability to disable pattern comparison on demand
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hivemind/tavern/validate_response.py
+4
-3
4 additions, 3 deletions
hivemind/tavern/validate_response.py
with
4 additions
and
3 deletions
hivemind/tavern/validate_response.py
+
4
−
3
View file @
1ae2a4b1
...
@@ -36,9 +36,6 @@ def remove_tag(data, tags_to_remove):
...
@@ -36,9 +36,6 @@ def remove_tag(data, tags_to_remove):
def
compare_response_with_pattern
(
response
,
method
=
None
,
directory
=
None
,
ignore_tags
=
None
,
error_response
=
False
):
def
compare_response_with_pattern
(
response
,
method
=
None
,
directory
=
None
,
ignore_tags
=
None
,
error_response
=
False
):
"""
This method will compare response with pattern file
"""
"""
This method will compare response with pattern file
"""
import
os
import
os
# disable coparison with pattern on demand
if
bool
(
os
.
getenv
(
'
TAVERN_DISABLE_COMPARATOR
'
,
False
)):
return
response_fname
=
directory
+
"
/
"
+
method
+
RESPONSE_FILE_EXT
response_fname
=
directory
+
"
/
"
+
method
+
RESPONSE_FILE_EXT
if
os
.
path
.
exists
(
response_fname
):
if
os
.
path
.
exists
(
response_fname
):
...
@@ -67,6 +64,10 @@ def compare_response_with_pattern(response, method=None, directory=None, ignore_
...
@@ -67,6 +64,10 @@ def compare_response_with_pattern(response, method=None, directory=None, ignore_
save_json
(
response_fname
,
response_json
)
save_json
(
response_fname
,
response_json
)
raise
PatternDiffException
(
msg
)
raise
PatternDiffException
(
msg
)
# disable coparison with pattern on demand
if
bool
(
os
.
getenv
(
'
TAVERN_DISABLE_COMPARATOR
'
,
False
)):
return
import
deepdiff
import
deepdiff
pattern
=
load_pattern
(
directory
+
"
/
"
+
method
+
PATTERN_FILE_EXT
)
pattern
=
load_pattern
(
directory
+
"
/
"
+
method
+
PATTERN_FILE_EXT
)
if
ignore_tags
is
not
None
:
if
ignore_tags
is
not
None
:
...
...
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