diff options
author | Pjotr Prins | 2018-02-15 08:44:57 +0000 |
---|---|---|
committer | Pjotr Prins | 2018-02-15 08:44:57 +0000 |
commit | d636315ad629cb56ea3e697924160432f6132792 (patch) | |
tree | 476ed4196409a1dc918a41ca8d86400863eab875 /wqflask/tests/es_double.py | |
parent | 2602be69f2869de376d1b9ced6131d880e9476c2 (diff) | |
parent | 1defefd05d0eb658fb5922fc755547261a5e914a (diff) | |
download | genenetwork2-d636315ad629cb56ea3e697924160432f6132792.tar.gz |
Fix conflict
Diffstat (limited to 'wqflask/tests/es_double.py')
-rw-r--r-- | wqflask/tests/es_double.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/wqflask/tests/es_double.py b/wqflask/tests/es_double.py new file mode 100644 index 00000000..00739016 --- /dev/null +++ b/wqflask/tests/es_double.py @@ -0,0 +1,30 @@ +class ESDouble(object): + def __init__(self): + self.items = { + "users": { + "local": [] + }} + + def ping(self): + return true + + def create(self, index, doc_type, body, id): + item = {"id": id, "_source": body} + if not self.items.get("index", None): + self.items[index] = {doc_type: [item]} + else: + self.items[index][doc_type].append(item) + + def search(self, index, doc_type, body): + d = body["query"]["match"] + column = [(key, d[key]) for key in d] + + items = [] + for thing in self.items[index][doc_type]: + if thing["_source"][column[0][0]] == column[0][1]: + items.append(thing) + break + return { + "hits": { + "hits": items + }} |