From 64f8b661e992ec40c93a3a37b35d08f27dfb146c Mon Sep 17 00:00:00 2001 From: Vitaly Gavensky Date: Mon, 20 May 2024 14:34:29 +0300 Subject: [PATCH] Rest API test (initial steps) --- .../tests/exclude_list_rest_api_tests.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/plugins/pdr_deterministic_plugin/tests/exclude_list_rest_api_tests.py b/plugins/pdr_deterministic_plugin/tests/exclude_list_rest_api_tests.py index 8358a9892..fae05c643 100644 --- a/plugins/pdr_deterministic_plugin/tests/exclude_list_rest_api_tests.py +++ b/plugins/pdr_deterministic_plugin/tests/exclude_list_rest_api_tests.py @@ -17,7 +17,6 @@ import time #import pytest import requests -from exclude_list import ExcludeListItem #pytest.mark.run(order=0) @@ -29,18 +28,13 @@ def test_exclude_list_rest_api(): url = "http://127.0.0.1:8977/excluded" excluded_ports = [ - ExcludeListItem("0123456789aaabbb_1", 0), # Add forever - ExcludeListItem("9876543210cccddd_2", 30), # Add for 30 seconds - ExcludeListItem("3456789012eeefff_3", 0) # Add forever + ("0123456789aaabbb_1", 0), # Add forever + ("9876543210cccddd_2", 30), # Add for 30 seconds + ("3456789012eeefff_3", 0) # Add forever ] - # Prepare data for PUT HTTP request - data = [] - for port in excluded_ports: - data.append([port.port_name, port.ttl_seconds]) - # Add ports to excluded list - response = requests.put(url, data=json.dumps(data), headers={'Content-Type': 'application/json'}, timeout=5, auth = None, verify = False) + response = requests.put(url, data=json.dumps(excluded_ports), headers={'Content-Type': 'application/json'}, timeout=5, auth = None, verify = False) assert response.status_code == http.client.OK