aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/es_double.py
diff options
context:
space:
mode:
authorPjotr Prins2018-02-15 14:03:38 +0000
committerPjotr Prins2018-02-15 14:03:38 +0000
commit4097723cfd6331f41d8b8e7abec322cb12f39f10 (patch)
treeb0238e5670abf9fd980b295a7beb75ba634578de /wqflask/tests/es_double.py
parent9d47ad572f46397bdd778d8f6e1c37d40e12aa2a (diff)
downloadgenenetwork2-4097723cfd6331f41d8b8e7abec322cb12f39f10.tar.gz
Added unittest example
Diffstat (limited to 'wqflask/tests/es_double.py')
-rw-r--r--wqflask/tests/es_double.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/wqflask/tests/es_double.py b/wqflask/tests/es_double.py
deleted file mode 100644
index 00739016..00000000
--- a/wqflask/tests/es_double.py
+++ /dev/null
@@ -1,30 +0,0 @@
-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
- }}