aboutsummaryrefslogtreecommitdiff
path: root/test/requests/parametrized_test.py
blob: abf98fceb6aaf8f7bda55cf1a6feb12a077cba69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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"}}})