Browse Source

verify Accidentally did Query before DB

Mike Smith 11 years ago
parent
commit
1d60ca85e7
1 changed files with 18 additions and 2 deletions
  1. 18 2
      toolset/benchmark/framework_test.py

+ 18 - 2
toolset/benchmark/framework_test.py

@@ -127,13 +127,29 @@ class FrameworkTest:
       return False
       return False
     return True
     return True
 
 
+  ############################################################
+  # Validates the jsonString is a JSON object that has an "id"
+  # and a "randomNumber" key, and that both keys map to 
+  # integers.
+  ############################################################
+  def validateJson(self, jsonString):
+    obj = json.loads(jsonString)
+
+    if not obj:
+      return False
+    if not obj["id"] or type(obj["id"]) != int:
+      return False
+    if not obj["randomNumber"] or type(obj["randomNumber"]) != int:
+      return False
+    return True
+
   ############################################################
   ############################################################
   # Validates the jsonString is an array with a length of
   # Validates the jsonString is an array with a length of
   # 2, that each entry in the array is a JSON object, that
   # 2, that each entry in the array is a JSON object, that
   # each object has an "id" and a "randomNumber" key, and that
   # each object has an "id" and a "randomNumber" key, and that
   # both keys map to integers.
   # both keys map to integers.
   ############################################################
   ############################################################
-  def validateDb(self, jsonString):
+  def validateQuery(self, jsonString):
     arr = json.loads(jsonString)
     arr = json.loads(jsonString)
 
 
     if not arr or len(arr) != 2 or type(arr[0]) != dict or type(arr[1]) != dict:
     if not arr or len(arr) != 2 or type(arr[0]) != dict or type(arr[1]) != dict:
@@ -145,7 +161,7 @@ class FrameworkTest:
     if not arr[1]["id"] or type(arr[1]["id"]) != int:
     if not arr[1]["id"] or type(arr[1]["id"]) != int:
       return False
       return False
     if not arr[1]["randomNumber"] or type(arr[1]["randomNumber"]) != int:
     if not arr[1]["randomNumber"] or type(arr[1]["randomNumber"]) != int:
-      return False
+      return False 
     return True
     return True