diff options
author | Muriithi Frederick Muriuki | 2018-02-13 18:32:18 +0300 |
---|---|---|
committer | Pjotr Prins | 2018-03-26 09:29:29 +0000 |
commit | 11577cd84db5d7cc9cf10c2178d1f782a9809260 (patch) | |
tree | af7dd303cc7fd3203c36eea31d75c843e1aa734c /wqflask/tests/es_double.py | |
parent | c68cffc414ac6d7536db36e79914f7d57af741c6 (diff) | |
download | genenetwork2-11577cd84db5d7cc9cf10c2178d1f782a9809260.tar.gz |
Add tests for Registration process.
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 + }} |