WIFI-9990: Fixed the sdk client error (#657)

Improved the reporting in allure
Improved the logging

Signed-off-by: shivam <shivam.thakur@candelatech.com>
This commit is contained in:
Shivam Thakur
2022-06-29 11:52:16 +05:30
committed by GitHub
parent 412f0261b3
commit 1b5fe2d316
5 changed files with 222 additions and 216 deletions

View File

@@ -189,11 +189,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -203,11 +203,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -217,11 +217,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
version = resp.json()
@@ -232,11 +232,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -246,11 +246,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -260,11 +260,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -281,12 +281,12 @@ class Controller(ConfigureController):
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("POST", resp, self.make_headers(), payload, uri)
@@ -297,11 +297,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.delete(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("DELETE", resp, self.make_headers(), "", uri)
return resp
@@ -311,11 +311,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -325,11 +325,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -339,11 +339,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -353,11 +353,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -367,11 +367,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -381,11 +381,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -397,12 +397,12 @@ class Controller(ConfigureController):
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
@@ -414,12 +414,12 @@ class Controller(ConfigureController):
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
@@ -431,12 +431,12 @@ class Controller(ConfigureController):
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
@@ -448,12 +448,12 @@ class Controller(ConfigureController):
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
@@ -465,12 +465,12 @@ class Controller(ConfigureController):
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
@@ -482,12 +482,12 @@ class Controller(ConfigureController):
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
@@ -499,12 +499,12 @@ class Controller(ConfigureController):
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("POST", resp, self.make_headers(), payload, uri)
@@ -517,12 +517,12 @@ class Controller(ConfigureController):
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
@@ -534,12 +534,12 @@ class Controller(ConfigureController):
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.post(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("POST", resp, self.make_headers(), payload, uri)
return resp
@@ -549,11 +549,11 @@ class Controller(ConfigureController):
print("Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.get(uri, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("GET", resp, self.make_headers(), "", uri)
return resp
@@ -565,12 +565,12 @@ class Controller(ConfigureController):
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
allure.attach(name="Sending Command:", body="Sending Command: " + "\n" +
"TimeStamp: " + str(datetime.datetime.utcnow()) + "\n" +
"URI: " + str(uri) + "\n" +
"Data: " + str(payload) + "\n" +
"Headers: " + str(self.sdk_client.make_headers()))
"Headers: " + str(self.make_headers()))
resp = requests.put(uri, data=payload, headers=self.make_headers(), verify=False, timeout=100)
self.check_response("PUT", resp, self.make_headers(), payload, uri)

View File

@@ -11,10 +11,11 @@ import pytest
@pytest.mark.uc_sanity
@pytest.mark.ow_sdk_load_tests
@allure.parent_suite("OpenWifi SDK Tests")
@allure.parent_suite("OpenWifi FMS Service Tests")
@allure.suite("OpenWifi FMS Service Tests")
class TestUcentralFMSService(object):
@pytest.mark.system_info_fms
@allure.title("Get System Info FMS")
def test_system_info_fms(self, setup_controller):
system_info = setup_controller.get_system_fms()
print(system_info.json())

View File

@@ -17,7 +17,7 @@ import pytest
@pytest.mark.ow_sdk_load_tests
@pytest.mark.owgw_api_tests
@allure.parent_suite("OpenWifi SDK Tests")
@allure.parent_suite("OpenWifi Gateway Service Tests")
@allure.suite("OpenWifi Gateway Service Tests")
class TestUcentralGatewayService(object):
"""
"""
@@ -119,19 +119,19 @@ class TestUcentralGatewayService(object):
}
}
@pytest.mark.sdk_restapi
@allure.title("Get All Devices")
def test_gwservice_listdevices(self, setup_controller):
"""
Test the list devices endpoint
WIFI-3452
"""
resp = setup_controller.get_devices()
print(resp.json())
allure.attach(name="Devices", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Devices", body=str(resp.json()), #attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.sdk_restapi
@pytest.mark.gw_cred_dev
@allure.title("CRUD Device")
def test_gwservice_create_edit_delete_device(self, setup_controller, testbed):
"""
Test the create & edit and delete device endpoint
@@ -150,19 +150,19 @@ class TestUcentralGatewayService(object):
'macAddress': device_mac,
'manufacturer': 'Testing through Automation',
'owner': ''}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_controller.add_device_to_gw(device_name, payload)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Gateway create device", body=body)
#allure.attach(name="Gateway create device", body=body)
if resp.status_code != 200:
assert False
devices = json.loads(resp.text)
print(devices)
#print(devices)
resp = setup_controller.get_device_by_serial_number(device_name)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Gateway create device-verify", body=body)
#allure.attach(name="Gateway create device-verify", body=body)
if resp.status_code != 200:
assert False
@@ -174,98 +174,107 @@ class TestUcentralGatewayService(object):
}
]
}
print(json.dumps(editing_payload))
#print(json.dumps(editing_payload))
resp = setup_controller.edit_device_on_gw(device_name, editing_payload)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Gateway edited device", body=body)
#allure.attach(name="Gateway edited device", body=body)
if resp.status_code != 200:
assert False
devices = json.loads(resp.text)
print(devices)
#print(devices)
resp = setup_controller.get_device_by_serial_number(device_name)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Gateway edited device-verify", body=body)
#allure.attach(name="Gateway edited device-verify", body=body)
if resp.status_code != 200:
assert False
resp = setup_controller.delete_device_from_gw(device_name)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="gw created device-delete", body=body)
#allure.attach(name="gw created device-delete", body=body)
if resp.status_code != 200:
assert False
@pytest.mark.system_info_gw
@allure.title("System Info OW Gateway Service")
def test_system_info_gw(self, setup_controller):
system_info = setup_controller.get_system_gw()
print(system_info.json())
allure.attach(name="system info", body=str(system_info.json()), attachment_type=allure.attachment_type.JSON)
#print(system_info.json())
#allure.attach(name="system info", body=str(system_info.json()), #attachment_type=#allure.#attachment_type.JSON)
assert system_info.status_code == 200
@pytest.mark.gw_commands
@allure.title("Get OW Gateway Commands")
def test_gw_commands(self, setup_controller):
system_info = setup_controller.get_commands()
print(system_info.json())
allure.attach(name="Gateway list of commands", body=str(system_info.json()),
attachment_type=allure.attachment_type.JSON)
#print(system_info.json())
#allure.attach(name="Gateway list of commands", body=str(system_info.json()),
##attachment_type=#allure.#attachment_type.JSON)
assert system_info.status_code == 200
@pytest.mark.gw_device_logs
@allure.title("Get Device Logs")
def test_gw_service_get_logs(self, setup_controller, get_configuration):
"""
Test the device logs present in Gateway UI
"""
device_name = get_configuration['access_point'][0]['serial']
resp = setup_controller.get_device_logs(device_name)
print(resp.json())
allure.attach(name="Device Logs", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device Logs", body=str(resp.json()), #attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_device_health_checks
@allure.title("Get Health Checks")
def test_gw_service_get_health_checks(self, setup_controller, get_configuration):
"""
Test the device health checks present in Gateway UI
"""
device_name = get_configuration['access_point'][0]['serial']
resp = setup_controller.get_device_health_checks(device_name)
print(resp.json())
allure.attach(name="Device Health checks", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device Health checks", body=str(resp.json()), #attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_device_capabilities
@allure.title("Get Capabilities")
def test_gw_service_get_capabilities(self, setup_controller, get_configuration):
"""
Test the device capabilities present in Gateway UI
"""
device_name = get_configuration['access_point'][0]['serial']
resp = setup_controller.get_device_capabilities(device_name)
print(resp.json())
allure.attach(name="Device capabilities", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device capabilities", body=str(resp.json()), #attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_device_statistics
@allure.title("Get Statistics")
def test_gw_service_get_statistics(self, setup_controller, get_configuration):
"""
Test the device statistics present in Gateway UI
"""
device_name = get_configuration['access_point'][0]['serial']
resp = setup_controller.get_device_statistics(device_name)
print(resp.json())
allure.attach(name="Device statistics", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device statistics", body=str(resp.json()), #attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_device_status
@allure.title("Get Device Status")
def test_gw_service_get_status(self, setup_controller, get_configuration):
"""
Test the device status present in Gateway UI
"""
device_name = get_configuration['access_point'][0]['serial']
resp = setup_controller.get_device_status(device_name)
print(resp.json())
allure.attach(name="Device status", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device status", body=str(resp.json()), #attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_ping_device
@allure.title("Ping Device")
def test_gw_service_ping_device(self, setup_controller, get_configuration):
"""
Test to Ping device present in Gateway UI
@@ -274,12 +283,14 @@ class TestUcentralGatewayService(object):
payload = {
"serialNumber": device_name
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_controller.ping_device(device_name, payload)
print(resp.json())
allure.attach(name="Device Ping status", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device Ping status", body=str(resp.json()), #attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_led_blink_device
@allure.title("Blink LED API")
def test_gw_service_led_blink_device(self, setup_controller, get_configuration):
"""
Test to Blink led on device present in Gateway UI
@@ -291,13 +302,15 @@ class TestUcentralGatewayService(object):
"duration": 1,
"pattern": "on"
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_controller.led_blink_device(device_name, payload)
print(resp.json())
allure.attach(name="Device Blink led status", body=str(resp.json()),
attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device Blink led status", body=str(resp.json()),
#attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_trace_device
@allure.title("Trace Command")
def test_gw_service_trace_device(self, setup_controller, get_configuration):
"""
Test to trace device present in Gateway UI
@@ -311,12 +324,14 @@ class TestUcentralGatewayService(object):
"network": "string",
"interface": "string"
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_controller.trace_device(device_name, payload)
print(resp.json())
allure.attach(name="Device trace status", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device trace status", body=str(resp.json()), #attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_wifi_scan_device
@allure.title("Wi-Fi Scan Device")
def test_gw_service_wifi_scan_device(self, setup_controller, get_configuration):
"""
Test to Wifi scan device present in Gateway UI
@@ -332,13 +347,15 @@ class TestUcentralGatewayService(object):
]
}
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_controller.wifi_scan_device(device_name, payload)
print(resp.json())
allure.attach(name="Device Wifi scan status", body=str(resp.json()),
attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device Wifi scan status", body=str(resp.json()),
#attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_request_msg_device
@allure.title("Request Message Device")
def test_gw_service_request_msg_device(self, setup_controller, get_configuration):
"""
Test to Request specific msg from device present in Gateway UI
@@ -349,13 +366,15 @@ class TestUcentralGatewayService(object):
"when": 0,
"message": "state"
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_controller.request_specific_msg_from_device(device_name, payload)
print(resp.json())
allure.attach(name="Device Request specific msg status", body=str(resp.json()),
attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device Request specific msg status", body=str(resp.json()),
#attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_event_queue_device
@allure.title("Get Event Queue of Device")
def test_gw_service_event_queue_device(self, setup_controller, get_configuration):
"""
Test to Request Event Queue from device present in Gateway UI
@@ -367,13 +386,15 @@ class TestUcentralGatewayService(object):
"dhcp"
]
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_controller.event_queue(device_name, payload)
print(resp.json())
allure.attach(name="Device Request Event Queue status", body=str(resp.json()),
attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device Request Event Queue status", body=str(resp.json()),
#attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_telemetry_device
@allure.title("Telemetry Device")
def test_gw_service_telemetry_device(self, setup_controller, get_configuration):
"""
Test to Request telemetry from device present in Gateway UI
@@ -389,19 +410,21 @@ class TestUcentralGatewayService(object):
],
"uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_controller.telemetry(device_name, payload)
print(resp.json())
allure.attach(name="Device telemetry status", body=str(resp.json()),
attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device telemetry status", body=str(resp.json()),
#attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.gw_rtty
@allure.title("RTTY API")
def test_gw_service_get_rtty(self, setup_controller, get_configuration):
"""
Test the device rtty parameters in Gateway UI
"""
device_name = get_configuration['access_point'][0]['serial']
resp = setup_controller.get_rtty_params(device_name)
print(resp.json())
allure.attach(name="Device RTTY parameters", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Device RTTY parameters", body=str(resp.json()), #attachment_type=#allure.#attachment_type.JSON)
assert resp.status_code == 200

View File

@@ -17,22 +17,23 @@ import pytest
@pytest.mark.ow_sdk_load_tests
@pytest.mark.owprov_api_tests
@allure.parent_suite("OpenWifi SDK Tests")
@allure.parent_suite("OpenWifi Provisioning Service Tests")
@allure.suite("OpenWifi Provisioning Service Tests")
class TestUcentralProvisionService(object):
@pytest.mark.sdk_restapi
@pytest.mark.prov_api
@allure.title("Get All Inventory List")
def test_provservice_inventorylist(self, setup_prov_controller, get_configuration):
"""
Test the device present in Provisioning UI
"""
device_name = get_configuration['access_point'][0]['serial']
resp = setup_prov_controller.get_inventory_by_device(device_name)
print(resp.json())
allure.attach(name="Inventory", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Inventory", body=str(resp.json()), attachment_type=#allure.attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.prov_api_test
@allure.title("CRUD Inventory")
def test_prov_service_create_edit_delete_inventory_device(self, setup_prov_controller, testbed):
"""
Test the create device in provision Inventory
@@ -60,19 +61,19 @@ class TestUcentralProvisionService(object):
"deviceTypes": ["edgecore_eap101"]
}
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_prov_controller.add_device_to_inventory(device_name, payload)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov create device", body=body)
#allure.attach(name="Prov create device", body=body)
if resp.status_code != 200:
assert False
devices = json.loads(resp.text)
print(devices)
#print(devices)
resp = setup_prov_controller.get_inventory_by_device(device_name)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov create device-verify", body=body)
#allure.attach(name="Prov create device-verify", body=body)
if resp.status_code != 200:
assert False
@@ -87,36 +88,38 @@ class TestUcentralProvisionService(object):
"rrm": "inherit",
"venue": ""
}
print(json.dumps(editing_payload))
#print(json.dumps(editing_payload))
resp = setup_prov_controller.edit_device_from_inventory(device_name, editing_payload)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov edited device", body=body)
#allure.attach(name="Prov edited device", body=body)
if resp.status_code != 200:
assert False
devices = json.loads(resp.text)
print(devices)
#print(devices)
resp = setup_prov_controller.get_inventory_by_device(device_name)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov edited device-verify", body=body)
#allure.attach(name="Prov edited device-verify", body=body)
if resp.status_code != 200:
assert False
resp = setup_prov_controller.delete_device_from_inventory(device_name)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov created device-delete", body=body)
#allure.attach(name="Prov created device-delete", body=body)
if resp.status_code != 200:
assert False
@pytest.mark.system_info_prov
@allure.title("System Info OW Prov Service")
def test_system_info_prov(self, setup_prov_controller):
system_info = setup_prov_controller.get_system_prov()
print(system_info.json())
allure.attach(name="system info", body=str(system_info.json()), attachment_type=allure.attachment_type.JSON)
#print(system_info.json())
#allure.attach(name="system info", body=str(system_info.json()), attachment_type=#allure.attachment_type.JSON)
assert system_info.status_code == 200
@pytest.mark.prov_api_entity_test
@allure.title("CRUD Entity")
def test_prov_service_create_edit_delete_entity(self, setup_prov_controller, testbed):
"""
Test the create Entity in provision Inventory
@@ -127,20 +130,20 @@ class TestUcentralProvisionService(object):
"notes": [{"note": "For testing Purposes through Automation"}],
"parent": "0000-0000-0000"
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_prov_controller.add_entity(payload)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov create entity", body=body)
#allure.attach(name="Prov create entity", body=body)
if resp.status_code != 200:
assert False
entitiy = json.loads(resp.text)
print(entitiy)
#print(entitiy)
entity_id = entitiy['id']
resp = setup_prov_controller.get_entity_by_id(entity_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov create device-verify", body=body)
#allure.attach(name="Prov create device-verify", body=body)
if resp.status_code != 200:
assert False
@@ -154,44 +157,46 @@ class TestUcentralProvisionService(object):
"sourceIP": [],
"uuid": entity_id
}
print(json.dumps(editing_payload))
#print(json.dumps(editing_payload))
resp = setup_prov_controller.edit_entity(editing_payload, entity_id)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov edited entity", body=body)
#allure.attach(name="Prov edited entity", body=body)
if resp.status_code != 200:
assert False
entitiy = json.loads(resp.text)
print(entitiy)
#print(entitiy)
resp = setup_prov_controller.get_entity_by_id(entity_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov edited device-verify", body=body)
#allure.attach(name="Prov edited device-verify", body=body)
if resp.status_code != 200:
assert False
resp = setup_prov_controller.delete_entity(entity_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov created device-delete", body=body)
#allure.attach(name="Prov created device-delete", body=body)
if resp.status_code != 200:
assert False
@pytest.mark.prov_api_entity
def test_get_entities(self, setup_prov_controller):
resp = setup_prov_controller.get_entity()
print(resp.json())
allure.attach(name="Entities", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Entities", body=str(resp.json()), attachment_type=#allure.attachment_type.JSON)
assert resp.status_code == 200
# Contact related Test cases
@pytest.mark.prov_api_contact
@allure.title("Get Contacts")
def test_get_contacts(self, setup_prov_controller):
resp = setup_prov_controller.get_contact()
print(resp.json())
allure.attach(name="Contacts", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="Contacts", body=str(resp.json()), attachment_type=#allure.attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.prov_api_contact_test
@allure.title("CRUD Contact")
def test_prov_service_create_edit_delete_contact(self, setup_prov_controller, testbed):
"""
Test the create Contact in provision Inventory
@@ -215,20 +220,20 @@ class TestUcentralProvisionService(object):
"entity": "0000-0000-0000",
"notes": [{"note": ""}]
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_prov_controller.add_contact(payload)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov create contact", body=body)
#allure.attach(name="Prov create contact", body=body)
if resp.status_code != 200:
assert False
contact = json.loads(resp.text)
print(contact)
#print(contact)
contact_id = contact['id']
resp = setup_prov_controller.get_contact_by_id(contact_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov create contact-verify", body=body)
#allure.attach(name="Prov create contact-verify", body=body)
if resp.status_code != 200:
assert False
@@ -250,37 +255,39 @@ class TestUcentralProvisionService(object):
"title": "Testing_contact",
"type": "USER"
}
print(json.dumps(editing_payload))
#print(json.dumps(editing_payload))
resp = setup_prov_controller.edit_contact(editing_payload, contact_id)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov edited contact", body=body)
#allure.attach(name="Prov edited contact", body=body)
if resp.status_code != 200:
assert False
entitiy = json.loads(resp.text)
print(entitiy)
#print(entitiy)
resp = setup_prov_controller.get_contact_by_id(contact_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov edited contact-verify", body=body)
#allure.attach(name="Prov edited contact-verify", body=body)
if resp.status_code != 200:
assert False
resp = setup_prov_controller.delete_contact(contact_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov created contact-delete", body=body)
#allure.attach(name="Prov created contact-delete", body=body)
if resp.status_code != 200:
assert False
# Location related Test cases
@pytest.mark.prov_api_location
@allure.title("Get Locations")
def test_get_locations(self, setup_prov_controller):
resp = setup_prov_controller.get_location()
print(resp.json())
allure.attach(name="location", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="location", body=str(resp.json()), attachment_type=#allure.attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.prov_api_location_test
@allure.title("CRUD Location")
def test_prov_service_create_edit_delete_location(self, setup_prov_controller, testbed):
"""
Test the create location in provision Inventory
@@ -302,20 +309,20 @@ class TestUcentralProvisionService(object):
"entity": "0000-0000-0000",
"notes": [{"note": "Testing purposes"}]
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_prov_controller.add_location(payload)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov create location", body=body)
#allure.attach(name="Prov create location", body=body)
if resp.status_code != 200:
assert False
location = json.loads(resp.text)
print(location)
#print(location)
location_id = location['id']
resp = setup_prov_controller.get_location_by_id(location_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov create location-verify", body=body)
#allure.attach(name="Prov create location-verify", body=body)
if resp.status_code != 200:
assert False
@@ -339,37 +346,39 @@ class TestUcentralProvisionService(object):
"state": "Andhra Pradesh",
"type": "SERVICE"
}
print(json.dumps(editing_payload))
#print(json.dumps(editing_payload))
resp = setup_prov_controller.edit_location(editing_payload, location_id)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov edited location", body=body)
#allure.attach(name="Prov edited location", body=body)
if resp.status_code != 200:
assert False
entitiy = json.loads(resp.text)
print(entitiy)
#print(entitiy)
resp = setup_prov_controller.get_location_by_id(location_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov edited location-verify", body=body)
#allure.attach(name="Prov edited location-verify", body=body)
if resp.status_code != 200:
assert False
resp = setup_prov_controller.delete_location(location_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov created location-delete", body=body)
#allure.attach(name="Prov created location-delete", body=body)
if resp.status_code != 200:
assert False
# Venue related Test cases
@pytest.mark.prov_api_venue
@allure.title("Get Venue")
def test_get_venue(self, setup_prov_controller):
resp = setup_prov_controller.get_venue()
print(resp.json())
allure.attach(name="venue", body=str(resp.json()), attachment_type=allure.attachment_type.JSON)
#print(resp.json())
#allure.attach(name="venue", body=str(resp.json()), attachment_type=#allure.attachment_type.JSON)
assert resp.status_code == 200
@pytest.mark.prov_api_venue_test
@allure.title("CRUD Venue")
def test_prov_service_create_edit_delete_venue(self, setup_prov_controller, testbed):
"""
Test the create venue in provision Inventory
@@ -387,20 +396,20 @@ class TestUcentralProvisionService(object):
"parent": "",
"rrm": "inherit"
}
print(json.dumps(payload))
#print(json.dumps(payload))
resp = setup_prov_controller.add_venue(payload)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov create venue", body=body)
#allure.attach(name="Prov create venue", body=body)
if resp.status_code != 200:
assert False
venue = json.loads(resp.text)
print(venue)
#print(venue)
venue_id = venue['id']
resp = setup_prov_controller.get_venue_by_id(venue_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov create venue-verify", body=body)
#allure.attach(name="Prov create venue-verify", body=body)
if resp.status_code != 200:
assert False
@@ -413,24 +422,24 @@ class TestUcentralProvisionService(object):
"rrm": "inherit",
"sourceIP": []
}
print(json.dumps(editing_payload))
#print(json.dumps(editing_payload))
resp = setup_prov_controller.edit_venue(editing_payload, venue_id)
allure.attach(name="response: ", body=str(resp.json()))
#allure.attach(name="response: ", body=str(resp.json()))
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov edited venue", body=body)
#allure.attach(name="Prov edited venue", body=body)
if resp.status_code != 200:
assert False
entitiy = json.loads(resp.text)
print(entitiy)
#print(entitiy)
resp = setup_prov_controller.get_venue_by_id(venue_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov edited venue-verify", body=body)
#allure.attach(name="Prov edited venue-verify", body=body)
if resp.status_code != 200:
assert False
resp = setup_prov_controller.delete_venue(venue_id)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="Prov created venue-delete", body=body)
#allure.attach(name="Prov created venue-delete", body=body)
if resp.status_code != 200:
assert False

View File

@@ -14,37 +14,10 @@ import allure
@pytest.mark.ow_sdk_load_tests
@pytest.mark.owsec_api_tests
@allure.parent_suite("OpenWifi SDK Tests")
@allure.parent_suite("OpenWifi Security Service Tests")
@allure.suite("OpenWifi Security Service Tests")
class TestUcentralSecService(object):
"""
Test the oauth endpoint
WIFI-3447
"""
'''
@pytest.mark.sdk_restapi
def test_secservice_oauth(self, setup_controller):
"""
pytest -m "uci_login"
"""
resp = setup_controller.login_resp
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="login", body=body)
assert setup_controller.login_resp.status_code == 200
@pytest.mark.sdk_restapi
def test_secservice_oauth_revoke(self, setup_controller):
"""
Test the oauth revoke endpoint
WIFI-3448
"""
resp = setup_controller.logout()
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="oauth revoke", body=body)
assert resp.status_code == 204
setup_controller.login()
'''
@pytest.mark.sdk_restapi
@allure.title("Get System Endpoints")
def test_secservice_system_endpoints(self, setup_controller):
"""
Test the system endpoints to verify list of services present
@@ -52,12 +25,12 @@ class TestUcentralSecService(object):
"""
resp = setup_controller.request("sec", "systemEndpoints", "GET", None, None)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="security systemEndpoints", body=body)
#allure.attach(name="security systemEndpoints", body=body)
if resp.status_code != 200:
assert False
services = json.loads(resp.text)
print(services)
#print(services)
if 'endpoints' not in services:
assert False
@@ -81,7 +54,7 @@ class TestUcentralSecService(object):
assert (num_services == 2) and (uri_present == 2) and (authtype_present == 2)
@pytest.mark.sdk_restapi
@allure.title("Get Security Version")
def test_secservice_get_version(self, setup_controller):
"""
Test the system endpoint to verify the version of the service
@@ -91,18 +64,18 @@ class TestUcentralSecService(object):
params = {'command': 'info'}
resp = setup_controller.request("sec", "system", "GET", params, None)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="security get version result", body=body)
#allure.attach(name="security get version result", body=body)
if resp.status_code != 200:
assert False
system = json.loads(resp.text)
print(system)
#print(system)
if 'version' not in system:
assert False
if system['version'] == '':
assert False
@pytest.mark.sdk_restapi
@allure.title("Get Secutity Service Uptime")
def test_secservice_get_uptime(self, setup_controller):
"""
Test the system endpoint to verify the uptime of the service
@@ -112,11 +85,11 @@ class TestUcentralSecService(object):
params = {'command': 'info'}
resp = setup_controller.request("sec", "system", "GET", params, None)
body = resp.url + "," + str(resp.status_code) + ',' + resp.text
allure.attach(name="security get uptime", body=body)
#allure.attach(name="security get uptime", body=body)
if resp.status_code != 200:
assert False
system = json.loads(resp.text)
print(system)
#print(system)
if 'uptime' not in system:
assert False