Wifi 7772 (#493)

* Added Entity library of Provision

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Added Entity Library support

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>

* Added Entity Related testcases

Signed-off-by: haricharan-jaka <haricharan.jaka@candelatech.com>
This commit is contained in:
Haricharan Jaka
2022-04-26 18:50:10 +05:30
committed by GitHub
parent e651f35a63
commit b86b61db45
2 changed files with 74 additions and 1 deletions

View File

@@ -74,7 +74,7 @@ class TestUcentralProvisionService(object):
if resp.status_code != 200:
assert False
resp = setup_prov_controller.request("prov", "inventory/" + device_name, "DELETE", None, None)
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)
if resp.status_code != 200:
@@ -86,3 +86,45 @@ class TestUcentralProvisionService(object):
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
def test_prov_service_create_entity(self, setup_prov_controller, testbed):
"""
Test the create Entity in provision Inventory
"""
payload = {"name": "Testing_prov",
"rrm": "inherit",
"description": "For testing Purposes through Automation",
"notes": [{"note": "For testing Purposes through Automation"}],
"parent": "0000-0000-0000"
}
print(json.dumps(payload))
resp = setup_prov_controller.add_entity(payload)
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)
if resp.status_code != 200:
assert False
entitiy = json.loads(resp.text)
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)
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)
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)
assert resp.status_code == 200