Fix security issues of eval-s in testapi
[releng.git] / utils / test / result_collection_api / opnfv_testapi / tests / unit / fake_pymongo.py
index 6ab98c7..3dd87e6 100644 (file)
@@ -116,8 +116,8 @@ class MemDb(object):
                 if k == 'start_date':
                     if not MemDb._compare_date(v, content.get(k)):
                         return False
-                elif k == 'trust_indicator':
-                    if float(content.get(k)) != float(v):
+                elif k == 'trust_indicator.current':
+                    if content.get('trust_indicator').get('current') != v:
                         return False
                 elif content.get(k, None) != v:
                     return False
@@ -173,7 +173,6 @@ class MemDb(object):
 
     def _check_keys(self, doc):
         for key in doc.keys():
-            print('key', key, 'value', doc.get(key))
             if '.' in key:
                 raise NameError('key {} must not contain .'.format(key))
             if key.startswith('$'):
@@ -182,6 +181,10 @@ class MemDb(object):
                 self._check_keys(doc.get(key))
 
 
+def __getattr__(name):
+    return globals()[name]
+
+
 pods = MemDb()
 projects = MemDb()
 testcases = MemDb()