def setUpClass(cls): form_pillow = XFormPillow(online=False) case_pillow = CasePillow(online=False) cls.pillows = [form_pillow, case_pillow] es = get_es_new() with trap_extra_setup(ConnectionError, msg="cannot connect to elasicsearch"): for pillow in cls.pillows: completely_initialize_pillow_index(pillow) initialize_index_and_mapping(es, GROUP_INDEX_INFO) case = new_case(closed=True) case_pillow.send_robust(case.to_json()) case = new_case(closed=False) case_pillow.send_robust(case.to_json()) case = new_case(closed=True, owner_id="foo") case_pillow.send_robust(case.to_json()) case = new_case(closed=False, owner_id="bar") case_pillow.send_robust(case.to_json()) group = Group(_id=uuid.uuid4().hex, users=["foo", "bar"]) cls.group_id = group._id send_to_elasticsearch('groups', group.to_json()) form = new_form(form={"meta": {"userID": None}}) form_pillow.send_robust(form.to_json()) form = new_form(form={"meta": {"userID": ""}}) form_pillow.send_robust(form.to_json()) form = new_form(form={"meta": {"deviceID": "abc"}}) form_pillow.send_robust(form.to_json()) form = new_form(form={"meta": {"userID": uuid.uuid4().hex}}) form_pillow.send_robust(form.to_json()) for pillow in cls.pillows: pillow.get_es_new().indices.refresh(pillow.es_index) es.indices.refresh(GROUP_INDEX_INFO.index)
def setUpClass(cls): with trap_extra_setup(ConnectionError, msg="cannot connect to elasicsearch"): es = get_es_new() cls.tearDownClass() initialize_index_and_mapping(es, CASE_INDEX_INFO) initialize_index_and_mapping(es, GROUP_INDEX_INFO) initialize_index_and_mapping(es, XFORM_INDEX_INFO) case = new_case(closed=True) send_to_elasticsearch('cases', case.to_json()) case = new_case(closed=False) send_to_elasticsearch('cases', case.to_json()) case = new_case(closed=True, owner_id="foo") send_to_elasticsearch('cases', case.to_json()) case = new_case(closed=False, owner_id="bar") send_to_elasticsearch('cases', case.to_json()) group = Group(_id=uuid.uuid4().hex, users=["foo", "bar"]) cls.group_id = group._id send_to_elasticsearch('groups', group.to_json()) form = new_form(form={"meta": {"userID": None}}) send_to_elasticsearch('forms', form.to_json()) form = new_form(form={"meta": {"userID": ""}}) send_to_elasticsearch('forms', form.to_json()) form = new_form(form={"meta": {"deviceID": "abc"}}) send_to_elasticsearch('forms', form.to_json()) form = new_form(form={"meta": {"userID": uuid.uuid4().hex}}) send_to_elasticsearch('forms', form.to_json()) es.indices.refresh(CASE_INDEX_INFO.index) es.indices.refresh(XFORM_INDEX_INFO.index) es.indices.refresh(GROUP_INDEX_INFO.index)