aboutsummaryrefslogtreecommitdiff
path: root/test/requests
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2018-02-19 12:48:36 +0300
committerPjotr Prins2018-03-26 09:29:29 +0000
commitf74b1615567d5cbf2cb00572cc14450ffd4b0c1c (patch)
tree2b4c4426f346618533d8dad818f6b2c961d27afe /test/requests
parent0f1197ce8afdc2a869e4cc6f78122641df009e42 (diff)
downloadgenenetwork2-f74b1615567d5cbf2cb00572cc14450ffd4b0c1c.tar.gz
Create parametrized superclass for tests
* Since the tests require that some parameters be provided while running the tests, create a class that helps abstract away the details of retrieving and setting the expected parameters.
Diffstat (limited to 'test/requests')
-rw-r--r--test/requests/parametrized_test.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/requests/parametrized_test.py b/test/requests/parametrized_test.py
new file mode 100644
index 00000000..abf98fce
--- /dev/null
+++ b/test/requests/parametrized_test.py
@@ -0,0 +1,27 @@
+import logging
+import unittest
+from elasticsearch import Elasticsearch, TransportError
+
+class ParametrizedTest(unittest.TestCase):
+
+ def __init__(self, methodName='runTest', gn2_url="http://localhost:5003", es_url="localhost:9200"):
+ super(ParametrizedTest, self).__init__(methodName=methodName)
+ self.gn2_url = gn2_url
+ self.es_url = es_url
+
+ def setUp(self):
+ self.es = Elasticsearch([self.es_url])
+ self.es_cleanup = []
+
+ es_logger = logging.getLogger("elasticsearch")
+ es_logger.addHandler(
+ logging.FileHandler("/tmp/es_TestRegistrationInfo.log"))
+ es_trace_logger = logging.getLogger("elasticsearch.trace")
+ es_trace_logger.addHandler(
+ logging.FileHandler("/tmp/es_TestRegistrationTrace.log"))
+
+ def tearDown(self):
+ self.es.delete_by_query(
+ index="users"
+ , doc_type="local"
+ , body={"query":{"match":{"email_address":"test@user.com"}}})