unit-test: Add code to read customer entries.

Will be able to use this to better understand current cloud
configuration.

Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear
2021-01-17 21:10:10 -08:00
parent 760e400d1d
commit b2a46fec1c
2 changed files with 24 additions and 1 deletions

View File

@@ -127,6 +127,16 @@ class CloudSDK:
response = requests.request("GET", fw_id_url, headers=headers, data=payload)
return response.json()
def get_customer(self, cloudSDK_url, bearer, customer_id):
fw_id_url = cloudSDK_url + "/portal/customer" + "?customerId=" + customer_id
payload = {}
headers = {
'Authorization': 'Bearer ' + bearer
}
response = requests.request("GET", fw_id_url, headers=headers, data=payload)
return response.json()
def delete_firmware(self, fw_id, cloudSDK_url, bearer):
url = cloudSDK_url + '/portal/firmware/version?firmwareVersionId=' + fw_id
payload = {}

View File

@@ -4,7 +4,7 @@ from UnitTestBase import *
base = UnitTestBase("query-sdk")
# 5G SSIDs
# Get customer profiles
try:
ssids = base.cloud.get_customer_profiles(base.cloudSDK_url, base.bearer, base.customer_id)
print("Profiles for customer %s:"%(base.customer_id))
@@ -14,3 +14,16 @@ except Exception as ex:
print(ex)
logging.error(logging.traceback.format_exc())
print("Failed to read customer profiles")
# Get customer info. I don't see any way to query for all customer IDs, so just look at first 3 for now.
for customer_id in range(4):
try:
# NOTE: Could also use base.customer_id to get single one that user may have specified.
ssids = base.cloud.get_customer(base.cloudSDK_url, base.bearer, "%i"%(customer_id))
print("Customer %i:"%(customer_id))
#jobj = json.load(ssids)
print(json.dumps(ssids, indent=4, sort_keys=True))
except Exception as ex:
print(ex)
logging.error(logging.traceback.format_exc())
print("Failed to read Customer %i"%(customer_id))