From 1cd1d5bc0282449beedea3939d4103738e5d7a2d Mon Sep 17 00:00:00 2001 From: Martin Kudlej Date: Mon, 25 Sep 2023 13:41:53 +0200 Subject: [PATCH 1/2] completely remove implicit backend --- testsuite/mockserver.py | 2 +- testsuite/tests/apicast/apiap/test_proxy_config.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testsuite/mockserver.py b/testsuite/mockserver.py index 17ec552d5..f1fed1cdd 100644 --- a/testsuite/mockserver.py +++ b/testsuite/mockserver.py @@ -91,5 +91,5 @@ def verify_sequence(self, expected_requests) -> bool: verify=self.verify, ) if response.status_code == 400: - raise HTTPError("Invalid matcher format", response=response) + raise HTTPError("Invalid matcher format", response=response) # type: ignore return response.status_code == 202 diff --git a/testsuite/tests/apicast/apiap/test_proxy_config.py b/testsuite/tests/apicast/apiap/test_proxy_config.py index 5244cf610..3df05c587 100644 --- a/testsuite/tests/apicast/apiap/test_proxy_config.py +++ b/testsuite/tests/apicast/apiap/test_proxy_config.py @@ -19,7 +19,7 @@ def service(custom_service, service_settings): """ Create a custom service without backend """ - return custom_service(service_settings) + return custom_service(service_settings, proxy_params={}, backends={}) def test_proxy_config(service, private_base_url): From 254b056d63ac3a668c33f5e220439c72c6de8d0c Mon Sep 17 00:00:00 2001 From: Martin Kudlej Date: Tue, 23 May 2023 14:10:50 +0200 Subject: [PATCH 2/2] first WIP PR to enable smoke test with APIA and on CRD client --- Makefile | 8 ++++ Pipfile | 5 ++ README.md | 13 +++++ pytest.ini | 1 + testsuite/mockserver.py | 2 +- testsuite/rawobj.py | 24 ++++++++-- testsuite/rhsso/__init__.py | 7 ++- .../apiap/test_apiap_routing_to_backend.py | 2 +- ...test_apiap_routing_with_backend_metrics.py | 2 +- ...test_apiap_routing_with_product_mapping.py | 2 +- .../apicast/apiap/test_backend_routing.py | 2 +- .../apicast_path_routing/conftest.py | 2 +- .../apicast/parameters/test_proxy_config.py | 2 +- .../test_batcher_policy_mapping_rules.py | 2 +- .../test_batcher_policy_nonalphanum_metric.py | 2 +- .../test_maintenance_mode_policy_host.py | 2 +- .../apicast/policy/test_policy_registry.py | 2 +- .../policy/tls/test_tls_path_routing.py | 2 +- .../conftest.py | 2 +- testsuite/tests/capabilities/__init__.py | 0 testsuite/tests/conftest.py | 47 ++++++++++++++++--- testsuite/tests/cr_capabilities/__init__.py | 0 .../mapping/test_delete_mapping_rules.py | 2 +- .../system/mapping/test_mapping_rules.py | 2 +- ..._rules_matching_order_multiple_backends.py | 2 +- testsuite/tests/toolbox/test_proxycfg.py | 2 +- 26 files changed, 111 insertions(+), 28 deletions(-) create mode 100644 testsuite/tests/capabilities/__init__.py create mode 100644 testsuite/tests/cr_capabilities/__init__.py diff --git a/Makefile b/Makefile index e024b23b1..3956947a7 100644 --- a/Makefile +++ b/Makefile @@ -100,6 +100,14 @@ smoke: ## Run basic smoke tests smoke: pipenv check-secrets.yaml $(PYTEST) -n6 -msmoke $(flags) testsuite/tests +capabilities-smoke: ## run smoke tests with 3scale-api-python-crd client +capabilities-smoke: pipenv check-secrets.yaml + $(PYTEST) -n3 --dist loadfile -msmoke --capabilities $(flags) testsuite + +capabilities-speedrun: ## run speedrun tests with 3scale-api-python-crd client +capabilities-speedrun: pipenv check-secrets.yaml + $(PYTEST) -n1 --dist loadfile -m 'not flaky' --drop-sandbag --drop-fuzz --capabilities $(flags) testsuite + flaky: ## Run flaky tests flaky: pipenv check-secrets.yaml $(PYTEST) -mflaky $(flags) testsuite/tests diff --git a/Pipfile b/Pipfile index f2ed6d254..99cb74c84 100644 --- a/Pipfile +++ b/Pipfile @@ -62,5 +62,10 @@ ansi2html = "*" # 3scale-api = {editable = true,path = "./../3scale-api-python"} # 3scale-api = {git = "https://github.com/pestanko/3scale-api-python.git", editable = true} +# 3scale Capabilities API client +3scale-api-crd = "*" +# 3scale-api-crd = {editable = true,path = "./../3scale-api-python-crd"} +# 3scale-api-crd = {git = "https://github.com/pestanko/3scale-api-python-crd.git", editable = true} + [requires] python_version = "3" diff --git a/README.md b/README.md index 40a451068..691992897 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,12 @@ Alternatively it can be set in the configuration. `make disruptive NAMESPACE=3scale` - tests with side-effect +`make capabilities-smoke NAMESPACE=3scale` + - smoke tests using 3scale Capabilities client instead of 3scale API client + +`make capabilities-speedrun NAMESPACE=3scale` + - speedrun tests using 3scale Capabilities client instead of 3scale API client + Targets can be combined `make test flaky NAMESPACE=3scale` @@ -171,6 +177,13 @@ Targets can be combined `make ./testsuite/tests/apicast/auth/test_basic_auth_user_key.py NAMESPACE=3scale` - to run particular test standalone +### 3scale Capabilities + +By default 3scale REST API client is used. 3scale Capabilities client can be used +instead of 3scale REST API client by using `--capabilities` argument. This argument +unlock running of specific Capabilities tests. For more information about 3scale Capabilities +see https://github.com/3scale/3scale-operator/blob/master/doc/operator-application-capabilities.md + ### Test Selection, Marks and Custom Arguments Selection of tests in the targets described above is based on pytest marks and diff --git a/pytest.ini b/pytest.ini index e53a38cb1..c9531e9d3 100644 --- a/pytest.ini +++ b/pytest.ini @@ -10,6 +10,7 @@ markers = issue: Reference to covered issue nopersistence: Tests incompatible with persistence plugin skipif_devrelease: Mark tests that should not run on alpha builds + nocrcap: Tests which are not compatible with CR capabilities API client filterwarnings = ignore: WARNING the new order is not taken into account:UserWarning ignore::urllib3.exceptions.InsecureRequestWarning diff --git a/testsuite/mockserver.py b/testsuite/mockserver.py index f1fed1cdd..17ec552d5 100644 --- a/testsuite/mockserver.py +++ b/testsuite/mockserver.py @@ -91,5 +91,5 @@ def verify_sequence(self, expected_requests) -> bool: verify=self.verify, ) if response.status_code == 400: - raise HTTPError("Invalid matcher format", response=response) # type: ignore + raise HTTPError("Invalid matcher format", response=response) return response.status_code == 202 diff --git a/testsuite/rawobj.py b/testsuite/rawobj.py index f3734087f..2e1c9127d 100644 --- a/testsuite/rawobj.py +++ b/testsuite/rawobj.py @@ -49,11 +49,21 @@ def Method(system_name: str, friendly_name: str = None, unit: str = "hit"): if friendly_name is None: friendly_name = system_name + # pylint: disable=possibly-unused-variable + name = system_name return locals() # pylint: disable=unused-argument -def Mapping(metric: dict, pattern: str = "/", http_method: str = "GET", delta: int = 1, last: str = "false"): +# pylint: disable=too-many-arguments +def Mapping( + metric: dict, + pattern: str = "/", + http_method: str = "GET", + delta: int = 1, + last: str = "false", + position: int = None, +): """Builder of parameters to create Mapping Args: :param metric: Metric to be mapped @@ -61,10 +71,13 @@ def Mapping(metric: dict, pattern: str = "/", http_method: str = "GET", delta: i :param http_method: Method to map; default: GET :param delta: Incremental unit; default: 1 :param last: If true, no other rules will be processed after - matching this one; default: false""" + matching this one; default: false + :param position: position in list of mapping rules""" metric_id = metric["id"] # pylint: disable=possibly-unused-variable del metric + if position is None: + del position return locals() @@ -86,7 +99,12 @@ def Application( if description is None: description = f"application {name}" - obj = {"name": name, "plan_id": application_plan["id"], "description": description} + obj = { + "name": name, + "plan_id": application_plan["id"], + "description": description, + "service_id": application_plan.service["id"], + } if account is not None: obj["account_id"] = account["id"] diff --git a/testsuite/rhsso/__init__.py b/testsuite/rhsso/__init__.py index 8c01ddf45..20fde5816 100644 --- a/testsuite/rhsso/__init__.py +++ b/testsuite/rhsso/__init__.py @@ -181,7 +181,12 @@ def __init__(self, rhsso_service_info, credentials_location="authorization", oid self.credentials_location = credentials_location self.oidc_configuration = oidc_configuration if self.oidc_configuration is None: - self.oidc_configuration = {"standard_flow_enabled": False, "direct_access_grants_enabled": True} + self.oidc_configuration = { + "standard_flow_enabled": False, + "direct_access_grants_enabled": True, + "implicit_flow_enabled": False, + "service_accounts_enabled": False, + } # pylint: disable=no-self-use def before_service(self, service_params: dict) -> dict: diff --git a/testsuite/tests/apicast/apiap/test_apiap_routing_to_backend.py b/testsuite/tests/apicast/apiap/test_apiap_routing_to_backend.py index 674c89f0b..3a18c1350 100644 --- a/testsuite/tests/apicast/apiap/test_apiap_routing_to_backend.py +++ b/testsuite/tests/apicast/apiap/test_apiap_routing_to_backend.py @@ -46,7 +46,7 @@ def mapping_rules(service, backend_bin, backend_echo): - Add mapping rule with path "/anything/bin" """ proxy = service.proxy.list() - proxy.mapping_rules.delete(proxy.mapping_rules.list()[0]["id"]) + proxy.mapping_rules.list()[0].delete() test_metric = backend_echo.metrics.list()[0] bin_metric = backend_bin.metrics.list()[0] diff --git a/testsuite/tests/apicast/apiap/test_apiap_routing_with_backend_metrics.py b/testsuite/tests/apicast/apiap/test_apiap_routing_with_backend_metrics.py index 6ba92d033..ab206f97d 100644 --- a/testsuite/tests/apicast/apiap/test_apiap_routing_with_backend_metrics.py +++ b/testsuite/tests/apicast/apiap/test_apiap_routing_with_backend_metrics.py @@ -50,7 +50,7 @@ def client(api_client, service): assert api_client().get("/get").status_code == 200 proxy = service.proxy.list() - proxy.mapping_rules.delete(proxy.mapping_rules.list()[0]["id"]) + proxy.mapping_rules.list()[0].delete() proxy.deploy() return api_client(disable_retry_status_list={404}) diff --git a/testsuite/tests/apicast/apiap/test_apiap_routing_with_product_mapping.py b/testsuite/tests/apicast/apiap/test_apiap_routing_with_product_mapping.py index 41edaadea..e86d51b91 100644 --- a/testsuite/tests/apicast/apiap/test_apiap_routing_with_product_mapping.py +++ b/testsuite/tests/apicast/apiap/test_apiap_routing_with_product_mapping.py @@ -45,7 +45,7 @@ def api_client(api_client, service): assert api_client().get("/bin/anything").status_code == 200 - proxy.mapping_rules.delete(proxy.mapping_rules.list()[0]["id"]) + proxy.mapping_rules.list()[0].delete() proxy.deploy() return api_client(disable_retry_status_list={404}) diff --git a/testsuite/tests/apicast/apiap/test_backend_routing.py b/testsuite/tests/apicast/apiap/test_backend_routing.py index b41777598..30f435ab8 100644 --- a/testsuite/tests/apicast/apiap/test_backend_routing.py +++ b/testsuite/tests/apicast/apiap/test_backend_routing.py @@ -44,7 +44,7 @@ def client(api_client, proxy): assert api_client().get("/echo/anything").status_code == 200 - proxy.mapping_rules.delete(proxy.mapping_rules.list()[0]["id"]) + proxy.mapping_rules.list()[0].delete() proxy.deploy() return api_client(disable_retry_status_list={404}) diff --git a/testsuite/tests/apicast/parameters/apicast_path_routing/conftest.py b/testsuite/tests/apicast/parameters/apicast_path_routing/conftest.py index 01cb18b4f..483695773 100644 --- a/testsuite/tests/apicast/parameters/apicast_path_routing/conftest.py +++ b/testsuite/tests/apicast/parameters/apicast_path_routing/conftest.py @@ -10,7 +10,7 @@ def delete_all_mapping_rules(proxy): """Deletes all mapping rules in a given proxy.""" mapping_rules = proxy.mapping_rules.list() for mapping_rule in mapping_rules: - proxy.mapping_rules.delete(mapping_rule["id"]) + mapping_rule.delete() @pytest.fixture(scope="module") diff --git a/testsuite/tests/apicast/parameters/test_proxy_config.py b/testsuite/tests/apicast/parameters/test_proxy_config.py index 502f4be36..509380fa7 100644 --- a/testsuite/tests/apicast/parameters/test_proxy_config.py +++ b/testsuite/tests/apicast/parameters/test_proxy_config.py @@ -44,7 +44,7 @@ def test_proxy_config(service, api_client): metric = service.metrics.list()[0] mapping_rules = service.proxy.mapping_rules - mapping_rules.delete(mapping_rules.list()[0]["id"]) + mapping_rules.list()[0].delete() mapping_rules.create(rawobj.Mapping(metric, pattern="/foo")) service.proxy.deploy() diff --git a/testsuite/tests/apicast/policy/batcher/test_batcher_policy_mapping_rules.py b/testsuite/tests/apicast/policy/batcher/test_batcher_policy_mapping_rules.py index 055cbf712..1bda07836 100644 --- a/testsuite/tests/apicast/policy/batcher/test_batcher_policy_mapping_rules.py +++ b/testsuite/tests/apicast/policy/batcher/test_batcher_policy_mapping_rules.py @@ -31,7 +31,7 @@ def service(service): metric = service.metrics.list()[0] # delete implicit '/' rule - proxy.mapping_rules.delete(proxy.mapping_rules.list()[0]["id"]) + proxy.mapping_rules.list()[0].delete() proxy.mapping_rules.create(rawobj.Mapping(metric, pattern="/get")) diff --git a/testsuite/tests/apicast/policy/batcher/test_batcher_policy_nonalphanum_metric.py b/testsuite/tests/apicast/policy/batcher/test_batcher_policy_nonalphanum_metric.py index c5410acc6..3f7c7273f 100644 --- a/testsuite/tests/apicast/policy/batcher/test_batcher_policy_nonalphanum_metric.py +++ b/testsuite/tests/apicast/policy/batcher/test_batcher_policy_nonalphanum_metric.py @@ -42,7 +42,7 @@ def service(service, metric_name): metric = service.metrics.create(rawobj.Metric(metric_name)) # delete implicit '/' rule - proxy.mapping_rules.delete(proxy.mapping_rules.list()[0]["id"]) + proxy.mapping_rules.list()[0].delete() service.proxy.list().mapping_rules.create(rawobj.Mapping(metric, "/", "GET")) service.proxy.list().update() diff --git a/testsuite/tests/apicast/policy/maintenance_mode/test_maintenance_mode_policy_host.py b/testsuite/tests/apicast/policy/maintenance_mode/test_maintenance_mode_policy_host.py index 4588b43c7..3bdc78e1a 100644 --- a/testsuite/tests/apicast/policy/maintenance_mode/test_maintenance_mode_policy_host.py +++ b/testsuite/tests/apicast/policy/maintenance_mode/test_maintenance_mode_policy_host.py @@ -56,7 +56,7 @@ def mapping_rules(service, backend_bin, backend_echo): - Add mapping rule with path "/anything/bin" """ proxy = service.proxy.list() - proxy.mapping_rules.delete(proxy.mapping_rules.list()[0]["id"]) + proxy.mapping_rules.list()[0].delete() test_metric = backend_echo.metrics.list()[0] bin_metric = backend_bin.metrics.list()[0] diff --git a/testsuite/tests/apicast/policy/test_policy_registry.py b/testsuite/tests/apicast/policy/test_policy_registry.py index 0478d0a3f..d9a137711 100644 --- a/testsuite/tests/apicast/policy/test_policy_registry.py +++ b/testsuite/tests/apicast/policy/test_policy_registry.py @@ -57,7 +57,7 @@ def custom_policies(threescale, schema, request, testconfig): def _cleanup(): for policy in policies: - threescale.policy_registry.delete(policy["id"]) + policy.delete() if not testconfig["skip_cleanup"]: request.addfinalizer(_cleanup) diff --git a/testsuite/tests/apicast/policy/tls/test_tls_path_routing.py b/testsuite/tests/apicast/policy/tls/test_tls_path_routing.py index a544a2c6d..c50929ba4 100644 --- a/testsuite/tests/apicast/policy/tls/test_tls_path_routing.py +++ b/testsuite/tests/apicast/policy/tls/test_tls_path_routing.py @@ -49,7 +49,7 @@ def delete_all_mapping_rules(proxy): """Deletes all mapping rules in a given proxy.""" mapping_rules = proxy.mapping_rules.list() for mapping_rule in mapping_rules: - proxy.mapping_rules.delete(mapping_rule["id"]) + mapping_rule.delete() @pytest.fixture(scope="module") diff --git a/testsuite/tests/apicast/policy/tls/tls_upstream/tls_passthrough_connection_reuse/conftest.py b/testsuite/tests/apicast/policy/tls/tls_upstream/tls_passthrough_connection_reuse/conftest.py index 6154d4b68..3493d8c62 100644 --- a/testsuite/tests/apicast/policy/tls/tls_upstream/tls_passthrough_connection_reuse/conftest.py +++ b/testsuite/tests/apicast/policy/tls/tls_upstream/tls_passthrough_connection_reuse/conftest.py @@ -104,7 +104,7 @@ def mapping_rules(service, backend_orig, backend_new): Adds the "/" mapping rule to both backends. """ proxy = service.proxy.list() - proxy.mapping_rules.delete(proxy.mapping_rules.list()[0]["id"]) + proxy.mapping_rules.list()[0].delete() orig_metric = backend_orig.metrics.list()[0] new_metric = backend_new.metrics.list()[0] diff --git a/testsuite/tests/capabilities/__init__.py b/testsuite/tests/capabilities/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/testsuite/tests/conftest.py b/testsuite/tests/conftest.py index ba2a1140b..57314a00e 100644 --- a/testsuite/tests/conftest.py +++ b/testsuite/tests/conftest.py @@ -17,7 +17,9 @@ import pytest from dynaconf.vendor.box.exceptions import BoxKeyError from pytest_metadata.plugin import metadata_key -from threescale_api import client, errors +from threescale_api_crd import client as crd_client +from threescale_api import client as rest_client +from threescale_api import errors from weakget import weakget # to actually initialize all the providers @@ -51,6 +53,13 @@ def term_handler(): signal.signal(signal.SIGTERM, orig) +@pytest.fixture(scope="session") +def api_client_type(pytestconfig): + """Do tests use REST API client(False) or CR Capabilities client(True)?""" + + return pytestconfig.getoption("capabilities") + + def pytest_addoption(parser): """Add option to include disruptive tests in testrun""" @@ -97,6 +106,9 @@ def pytest_addoption(parser): parser.addoption("--images", action="store_true", default=False, help="Run also image check tests (default: False)") parser.addoption("--tool-check", action="store_true", default=False, help="Run also tool availability check tests") parser.addoption("--sso-only", action="store_true", default=False, help="Run only tests that uses RHSSO/RHBK") + parser.addoption( + "--capabilities", action="store_true", default=False, help="Run tests with CR api client (default: False)" + ) def pytest_configure(config: pytest.Config) -> None: @@ -150,6 +162,10 @@ def pytest_runtest_setup(item): else: if Capability.APICAST not in CapabilityRegistry(): pytest.skip(f"Skipping test because current gateway doesn't have implicit capability {Capability.APICAST}") + if "/cr_capabilities/" in item.nodeid and not item.config.getoption("--capabilities"): + pytest.skip("Excluding CR Capabilities tests") + if "nocrcap" in marks and item.config.getoption("--capabilities"): + pytest.skip("Excluding tests incompatible with CR capabilities") @pytest.hookimpl(hookwrapper=True) @@ -439,9 +455,8 @@ def testconfig(): @pytest.fixture(scope="session", autouse=True) -def threescale(testconfig, request): +def threescale(testconfig, request, api_client_type): "Threescale client" - if weakget(testconfig)["fixtures"]["threescale"]["private_tenant"] % False: custom_tenant = request.getfixturevalue("custom_tenant") password = secrets.token_urlsafe(16) @@ -464,7 +479,16 @@ def threescale(testconfig, request): return admin - return client.ThreeScaleClient( + if api_client_type: + return crd_client.ThreeScaleClientCRD( + testconfig["threescale"]["admin"]["url"], + testconfig["threescale"]["admin"]["token"], + ssl_verify=testconfig["ssl_verify"], + ocp_namespace=testconfig["openshift"]["projects"]["threescale"]["name"], + wait=0, + ) + + return rest_client.ThreeScaleClient( testconfig["threescale"]["admin"]["url"], testconfig["threescale"]["admin"]["token"], ssl_verify=testconfig["ssl_verify"], @@ -473,10 +497,18 @@ def threescale(testconfig, request): @pytest.fixture(scope="session") -def master_threescale(testconfig): +def master_threescale(testconfig, api_client_type): """Threescale client using master url and token""" - return client.ThreeScaleClient( + if api_client_type: + return crd_client.ThreeScaleClientCRD( + testconfig["threescale"]["master"]["url"], + testconfig["threescale"]["master"]["token"], + ssl_verify=testconfig["ssl_verify"], + ocp_namespace=testconfig["openshift"]["projects"]["threescale"]["name"], + ) + + return rest_client.ThreeScaleClient( testconfig["threescale"]["master"]["url"], testconfig["threescale"]["master"]["token"], ssl_verify=testconfig["ssl_verify"], @@ -968,6 +1000,8 @@ def _custom_service( params["description"] = blame_desc(request, params.get("description")) svc = threescale_client.services.create(params=params) + if len(svc.mapping_rules.list()) == 0: + svc.mapping_rules.create(rawobj.Mapping(svc.metrics.list()[0], pattern="/")) self._autoclean = autoclean if not testconfig["skip_cleanup"]: @@ -978,7 +1012,6 @@ def finalizer(): hook(svc) except Exception: # pylint: disable=broad-except pass - svc.delete() with self._lock: diff --git a/testsuite/tests/cr_capabilities/__init__.py b/testsuite/tests/cr_capabilities/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/testsuite/tests/system/mapping/test_delete_mapping_rules.py b/testsuite/tests/system/mapping/test_delete_mapping_rules.py index aca69c894..17770c8a6 100644 --- a/testsuite/tests/system/mapping/test_delete_mapping_rules.py +++ b/testsuite/tests/system/mapping/test_delete_mapping_rules.py @@ -9,7 +9,7 @@ @pytest.fixture(scope="module") def service(service): """Removes default mapping rule from service""" - service.mapping_rules.delete(service.mapping_rules.list()[0].entity_id) + service.mapping_rules.list()[0].delete() service.proxy.deploy() return service diff --git a/testsuite/tests/system/mapping/test_mapping_rules.py b/testsuite/tests/system/mapping/test_mapping_rules.py index ecaa3d5bb..dc465f315 100644 --- a/testsuite/tests/system/mapping/test_mapping_rules.py +++ b/testsuite/tests/system/mapping/test_mapping_rules.py @@ -43,7 +43,7 @@ def service(service, endpoints_and_methods): metric = service.metrics.create(rawobj.Metric("metric")) # delete implicit '/' rule - proxy.mapping_rules.delete(proxy.mapping_rules.list()[0]["id"]) + proxy.mapping_rules.list()[0].delete() for url, method in endpoints_and_methods: proxy.mapping_rules.create(rawobj.Mapping(metric, pattern=url, http_method=method)) diff --git a/testsuite/tests/system/mapping/test_mapping_rules_matching_order_multiple_backends.py b/testsuite/tests/system/mapping/test_mapping_rules_matching_order_multiple_backends.py index fb0509d4c..76d3b2160 100644 --- a/testsuite/tests/system/mapping/test_mapping_rules_matching_order_multiple_backends.py +++ b/testsuite/tests/system/mapping/test_mapping_rules_matching_order_multiple_backends.py @@ -41,7 +41,7 @@ def proxy(service): def delete_mapping(proxy): """Deletes all current mapping on the product level""" proxy.deploy() - proxy.mapping_rules.delete(proxy.mapping_rules.list()[0]["id"]) + proxy.mapping_rules.list()[0].delete() proxy.deploy() return True diff --git a/testsuite/tests/toolbox/test_proxycfg.py b/testsuite/tests/toolbox/test_proxycfg.py index cab1e63a1..2dd11cce2 100644 --- a/testsuite/tests/toolbox/test_proxycfg.py +++ b/testsuite/tests/toolbox/test_proxycfg.py @@ -138,7 +138,7 @@ def test_list1(service, hits, empty_list_staging, create_cmd): mapping_rules = proxy.mapping_rules.list() for mapping_rule in mapping_rules: - proxy.mapping_rules.delete(mapping_rule["id"]) + mapping_rule.delete() proxy.mapping_rules.create(rawobj.Mapping(hits, "/ip")) proxy.mapping_rules.create(rawobj.Mapping(hits, "/anything", "POST"))