Skip to content

Commit

Permalink
Rest API test (initial steps)
Browse files Browse the repository at this point in the history
  • Loading branch information
vg12345 committed May 20, 2024
1 parent 412f9e6 commit 64f8b66
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import time
#import pytest
import requests
from exclude_list import ExcludeListItem


#pytest.mark.run(order=0)
Expand All @@ -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


Expand Down

0 comments on commit 64f8b66

Please sign in to comment.