aboutsummaryrefslogtreecommitdiff
path: root/wqflask/mock
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/mock
parent9d47ad572f46397bdd778d8f6e1c37d40e12aa2a (diff)
downloadgenenetwork2-4097723cfd6331f41d8b8e7abec322cb12f39f10.tar.gz
Added unittest example
Diffstat (limited to 'wqflask/mock')
-rw-r--r--wqflask/mock/__init__.py0
-rw-r--r--wqflask/mock/es_double.py15
2 files changed, 15 insertions, 0 deletions
diff --git a/wqflask/mock/__init__.py b/wqflask/mock/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/wqflask/mock/__init__.py
diff --git a/wqflask/mock/es_double.py b/wqflask/mock/es_double.py
new file mode 100644
index 00000000..6ef8a1b9
--- /dev/null
+++ b/wqflask/mock/es_double.py
@@ -0,0 +1,15 @@
+class ESDouble(object):
+ def __init__(self):
+ self.items = {}
+
+ def ping(self):
+ return true
+
+ def create(self, index, doc_type, body, id):
+ self.items["index"] = {doc_type: {"id": id, "_source": data}}
+
+ def search(self, index, doc_type, body):
+ return {
+ "hits": {
+ "hits": self.items[index][doc_type][body]
+ }}