/core/users Test: Test fail, XOS issue
Change-Id: I0adc4e3f1e86b210aefd20783652ae472bc98914
diff --git a/src/test/cord-api/Framework/restApi.py b/src/test/cord-api/Framework/restApi.py
index dd8b7ad..68c1d18 100644
--- a/src/test/cord-api/Framework/restApi.py
+++ b/src/test/cord-api/Framework/restApi.py
@@ -112,6 +112,7 @@
def ApiDelete(self, key, urlSuffix=""):
url = self.getURL(key) + str(urlSuffix)
+ print "url",url
resp = requests.delete(url, auth=(self.user, self.password))
passed = self.checkResult(resp, requests.codes.no_content)
return passed
@@ -132,8 +133,19 @@
time.sleep(5)
result = test.ApiDelete(key, urlSuffix)
'''
-'''
test = restApi()
+#key = "UTILS_SYNCHRONIZER"
+key = "CORE_USERS"
+key2 = "UTILS_LOGIN"
+#key = "TENANT_SUBSCRIBER"
+#jsonGetData = test.ApiGet(key)
+#jsonResponse = test.ApiPut(key,{"identity":{"name":"My House 22"}},"71")
+jsonResponse = test.ApiPost(key,{"firstname":"Test002","lastname":"User002","email":"test002@onlab.us","password":"TestUser002","site": "http://localhost:8000/api/core/sites/1/"})
+#jsonResponse = test.ApiDelete(key,15)
+#jsonResponse = test.ApiPut(key,{"firstname":"Test002","lastname":"User002","email":"test002update@onlab.us","password":"TestUser002","site": "http://localhost:8000/api/core/sites/1/"},14)
+#jsonResponse = test.ApiPost(key2,{"username":"test002update@onlab.us","password":"TestUser002"})
+#jsonResponse = test.ApiPost(key2,{"username":"padmin@vicci.org","password":"letmein"})
+#jsonResponse = test.ApiPut(key,{"username":"testuser","password":"TestUser001"},"9")
key = "UTILS_SYNCHRONIZER"
#key = "TENANT_SUBSCRIBER"
jsonGetData = test.ApiGet(key)
@@ -141,4 +153,3 @@
#jsonResponse = test.ApiPost(key,{"name":"test-2"})
jsonResponse = test.ApiPut(key,{"name":"test1-changed"},"9")
print "========="
-'''
diff --git a/src/test/cord-api/Framework/utils/utils.py b/src/test/cord-api/Framework/utils/utils.py
index 34de843..85508a5 100644
--- a/src/test/cord-api/Framework/utils/utils.py
+++ b/src/test/cord-api/Framework/utils/utils.py
@@ -71,9 +71,19 @@
key_value, found = self.search_dictionary(input_dict[key],search_key)
if found == True:
break
+ elif type(input_dict[key]) == list:
+ if not input_dict[key]:
+ found = False
+ break
+ for item in input_dict[key]:
+ if isinstance(item, dict):
+ key_value, found = self.search_dictionary(item, search_key)
+ if found == True:
+ break
return key_value,found
'''
- @method getDictFromGetJsonList
+ @method getDictFromListOfDict
+ return key_value,found
@Description: Searches for the dictionary in the provided list of dictionaries
that matches the value of the key provided
@params : List of dictionaries(getResponse Data from the URL),
@@ -119,20 +129,23 @@
@Returns: Returns the value of the Key that was provided
'''
def getFieldValueFromDict(self,search_dict, field):
- fields_found = []
results = ''
found = False
input_keys = search_dict.keys()
for key in input_keys:
if key == field:
results = search_dict[key]
- found = True
- break
+ if not results:
+ found = True
+ break
elif type(search_dict[key]) == dict:
results, found = self.search_dictionary(search_dict[key],field)
if found == True:
break
elif type(search_dict[key]) == list:
+ if not search_dict[key]:
+ found = False
+ break
for item in search_dict[key]:
if isinstance(item, dict):
results, found = self.search_dictionary(item, field)
@@ -147,6 +160,8 @@
#data=test.jsonToList("Subscribers.json","SubscriberInfo")
#print test.jsonToList("Subscribers.json","SubscriberInfo")
#print "index 1...",test.listToDict(data,1)
+#result = test.getDictFromListOfDict(dict_list,"email",21)
+result = test.getFieldValueFromDict(dict_list,"id")
result = test.getDictFromListOfDict(dict_list,"account_num",21)
print "finalllllll result....", result
'''