mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-22 10:57:07 -08:00
net-nntp/sabnzbd: Reenable functional API tests against tavern-2
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
From c8125e93bfb0963876992cb50c2442220c0ec300 Mon Sep 17 00:00:00 2001
|
||||
From: jcfp <jcfp@debian.org>
|
||||
Date: Mon, 20 Feb 2023 16:29:34 +0100
|
||||
Subject: [PATCH] convert tests to tavern 2.0.0+
|
||||
|
||||
---
|
||||
tests/data/tavern/api_get_files_format.yaml | 2 +-
|
||||
tests/data/tavern/api_history_empty.yaml | 2 +-
|
||||
tests/data/tavern/api_history_format.yaml | 2 +-
|
||||
tests/data/tavern/api_queue_empty.yaml | 2 +-
|
||||
tests/data/tavern/api_queue_format.yaml | 2 +-
|
||||
tests/data/tavern/api_server_stats.yaml | 2 +-
|
||||
tests/data/tavern/api_version.yaml | 4 ++--
|
||||
tests/requirements.txt | 2 +-
|
||||
8 files changed, 9 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/tests/data/tavern/api_get_files_format.yaml b/tests/data/tavern/api_get_files_format.yaml
|
||||
index e46823085b..9315fc27f8 100755
|
||||
--- a/tests/data/tavern/api_get_files_format.yaml
|
||||
+++ b/tests/data/tavern/api_get_files_format.yaml
|
||||
@@ -56,7 +56,7 @@ stages:
|
||||
pragma: "no-cache"
|
||||
access-control-allow-origin: "*"
|
||||
verify_response_with:
|
||||
- function: tavern.testutils.helpers:validate_regex
|
||||
+ function: tavern.helpers:validate_regex
|
||||
extra_kwargs:
|
||||
# Verify response parameters with a regex using positive
|
||||
# looksaheads, so parameters match regardless of their order
|
||||
diff --git a/tests/data/tavern/api_history_empty.yaml b/tests/data/tavern/api_history_empty.yaml
|
||||
index 0d15faabd5..22fa4e4511 100755
|
||||
--- a/tests/data/tavern/api_history_empty.yaml
|
||||
+++ b/tests/data/tavern/api_history_empty.yaml
|
||||
@@ -54,7 +54,7 @@ stages:
|
||||
access-control-allow-origin: "*"
|
||||
content-length: !re_match "[0-9]+"
|
||||
verify_response_with:
|
||||
- function: tavern.testutils.helpers:validate_regex
|
||||
+ function: tavern.helpers:validate_regex
|
||||
extra_kwargs:
|
||||
# Verify response with a regex using positive looksaheads so
|
||||
# parameters match regardless of their order of appearance
|
||||
diff --git a/tests/data/tavern/api_history_format.yaml b/tests/data/tavern/api_history_format.yaml
|
||||
index 99c64098e1..45de020706 100755
|
||||
--- a/tests/data/tavern/api_history_format.yaml
|
||||
+++ b/tests/data/tavern/api_history_format.yaml
|
||||
@@ -87,7 +87,7 @@ stages:
|
||||
access-control-allow-origin: "*"
|
||||
content-length: !re_match "[0-9]+"
|
||||
verify_response_with:
|
||||
- function: tavern.testutils.helpers:validate_regex
|
||||
+ function: tavern.helpers:validate_regex
|
||||
extra_kwargs:
|
||||
# Verify response parameters with a regex using positive looksaheads,
|
||||
# so parameters match regardless of their order of appearance. Note
|
||||
diff --git a/tests/data/tavern/api_queue_empty.yaml b/tests/data/tavern/api_queue_empty.yaml
|
||||
index d80d026e0e..5a3f45e2ea 100755
|
||||
--- a/tests/data/tavern/api_queue_empty.yaml
|
||||
+++ b/tests/data/tavern/api_queue_empty.yaml
|
||||
@@ -78,7 +78,7 @@ stages:
|
||||
access-control-allow-origin: "*"
|
||||
content-length: !re_match "[0-9]+"
|
||||
verify_response_with:
|
||||
- function: tavern.testutils.helpers:validate_regex
|
||||
+ function: tavern.helpers:validate_regex
|
||||
extra_kwargs:
|
||||
# Verify only a bunch of key response parameters with a regex using
|
||||
# positive looksaheads, so parameters match regardless of their order
|
||||
diff --git a/tests/data/tavern/api_queue_format.yaml b/tests/data/tavern/api_queue_format.yaml
|
||||
index 8411f4a272..fcbe708785 100755
|
||||
--- a/tests/data/tavern/api_queue_format.yaml
|
||||
+++ b/tests/data/tavern/api_queue_format.yaml
|
||||
@@ -98,7 +98,7 @@ stages:
|
||||
access-control-allow-origin: "*"
|
||||
content-length: !re_match "[0-9]+"
|
||||
verify_response_with:
|
||||
- function: tavern.testutils.helpers:validate_regex
|
||||
+ function: tavern.helpers:validate_regex
|
||||
extra_kwargs:
|
||||
# Verify only a bunch of key response parameters with a regex using
|
||||
# positive looksaheads, so parameters match regardless of their order
|
||||
diff --git a/tests/data/tavern/api_server_stats.yaml b/tests/data/tavern/api_server_stats.yaml
|
||||
index b42a1f2a38..a94a3b7823 100755
|
||||
--- a/tests/data/tavern/api_server_stats.yaml
|
||||
+++ b/tests/data/tavern/api_server_stats.yaml
|
||||
@@ -47,7 +47,7 @@ stages:
|
||||
content-length: !re_match "[0-9]+"
|
||||
status_code: 200
|
||||
verify_response_with:
|
||||
- function: tavern.testutils.helpers:validate_regex
|
||||
+ function: tavern.helpers:validate_regex
|
||||
extra_kwargs:
|
||||
expression: "{{(?=.*'total': [0-9]+)(?=.*'month': [0-9]+)(?=.*'week': [0-9]+)(?=.*'day': [0-9]+)(?=.*'servers': .*).*}}"
|
||||
|
||||
diff --git a/tests/data/tavern/api_version.yaml b/tests/data/tavern/api_version.yaml
|
||||
index ca11906cc9..8e81493353 100755
|
||||
--- a/tests/data/tavern/api_version.yaml
|
||||
+++ b/tests/data/tavern/api_version.yaml
|
||||
@@ -35,7 +35,7 @@ stages:
|
||||
content-type: !re_match "text/plain"
|
||||
content-type: !re_search "charset=(UTF|utf)-8"
|
||||
verify_response_with:
|
||||
- function: tavern.testutils.helpers:validate_regex
|
||||
+ function: tavern.helpers:validate_regex
|
||||
extra_kwargs:
|
||||
expression: "{SAB_VERSION}"
|
||||
|
||||
@@ -53,6 +53,6 @@ stages:
|
||||
content-type: !re_match "text/xml"
|
||||
content-type: !re_search "charset=(UTF|utf)-8"
|
||||
verify_response_with:
|
||||
- function: tavern.testutils.helpers:validate_regex
|
||||
+ function: tavern.helpers:validate_regex
|
||||
extra_kwargs:
|
||||
expression: '<\?xml version="1.0" encoding="UTF-8" \?>\r?\n?<version>{SAB_VERSION}</version>'
|
||||
diff --git a/tests/requirements.txt b/tests/requirements.txt
|
||||
index ea2fe6c403..60c160fe40 100644
|
||||
--- a/tests/requirements.txt
|
||||
+++ b/tests/requirements.txt
|
||||
@@ -9,7 +9,7 @@ pytest-httpbin
|
||||
pytest-httpserver
|
||||
flaky
|
||||
xmltodict
|
||||
-tavern<2.0.0 # tavalidate does not support tavern 2.0.0+
|
||||
+tavern>=2.0.0
|
||||
tavalidate
|
||||
importlib_metadata
|
||||
lxml
|
||||
@@ -42,6 +42,8 @@ DEPEND="
|
||||
dev-python/portend[${PYTHON_USEDEP}]
|
||||
dev-python/puremagic[${PYTHON_USEDEP}]
|
||||
~dev-python/sabyenc-5.4.4[${PYTHON_USEDEP}]
|
||||
dev-python/tavalidate[${PYTHON_USEDEP}]
|
||||
>=dev-python/tavern-2[${PYTHON_USEDEP}]
|
||||
')
|
||||
"
|
||||
RDEPEND="
|
||||
@@ -71,6 +73,10 @@ BDEPEND="
|
||||
)
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${P}-tavern-2.patch
|
||||
)
|
||||
|
||||
src_test() {
|
||||
local EPYTEST_IGNORE=(
|
||||
# network sandbox
|
||||
@@ -79,8 +85,6 @@ src_test() {
|
||||
tests/test_urlgrabber.py
|
||||
tests/test_utils/test_happyeyeballs.py
|
||||
tests/test_utils/test_internetspeed.py
|
||||
# requires tavern
|
||||
tests/test_functional_api.py
|
||||
)
|
||||
local EPYTEST_DESELECT=(
|
||||
# network sandbox
|
||||
@@ -106,6 +110,8 @@ src_test() {
|
||||
'tests/test_functional_misc.py::TestDaemonizing::test_daemonizing'
|
||||
)
|
||||
|
||||
local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
|
||||
local -x PYTEST_PLUGINS=tavern._core.pytest
|
||||
epytest -s
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user