diff options
Diffstat (limited to 'result_collection_api/tests/unit/fake_pymongo.py')
-rw-r--r-- | result_collection_api/tests/unit/fake_pymongo.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/result_collection_api/tests/unit/fake_pymongo.py b/result_collection_api/tests/unit/fake_pymongo.py index 95c7371..bebb9e8 100644 --- a/result_collection_api/tests/unit/fake_pymongo.py +++ b/result_collection_api/tests/unit/fake_pymongo.py @@ -74,10 +74,23 @@ class MemDb(object): return thread_execute(self._insert, doc_or_docs, check_keys) @staticmethod + def _compare_date(spec, value): + for k, v in spec.iteritems(): + if k == '$gte' and value >= v: + return True + return False + + @staticmethod def _in(content, *args): for arg in args: for k, v in arg.iteritems(): - if k != 'creation_date' and content.get(k, None) != v: + 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): + return False + elif content.get(k, None) != v: return False return True |