def setUp(self): self.domain_obj = create_domain(self.domain) self.region = LocationType.objects.create(domain=self.domain, name="region") self.town = LocationType.objects.create(domain=self.domain, name="town", parent_type=self.region) self.data_source_config = DataSourceConfiguration( domain=self.domain, display_name='Locations in Westworld', referenced_doc_type='Location', table_id=clean_table_name(self.domain, str(uuid.uuid4().hex)), configured_filter={}, configured_indicators=[{ "type": "expression", "expression": { "type": "property_name", "property_name": "name" }, "column_id": "location_name", "display_name": "location_name", "datatype": "string" }], ) self.data_source_config.validate() self.data_source_config.save() self.pillow = get_kafka_ucr_pillow() self.pillow.bootstrap(configs=[self.data_source_config]) with trap_extra_setup(KafkaUnavailableError): self.pillow.get_change_feed().get_latest_offsets()
def setUp(self): self.domain_obj = create_domain(self.domain) es = get_es_new() initialize_index_and_mapping(es, USER_INDEX_INFO) self.region = LocationType.objects.create(domain=self.domain, name="region") self.town = LocationType.objects.create(domain=self.domain, name="town", parent_type=self.region) self.data_source_config = DataSourceConfiguration( domain=self.domain, display_name='Locations in Westworld', referenced_doc_type='Location', table_id=clean_table_name(self.domain, str(uuid.uuid4().hex)), configured_filter={}, configured_indicators=[{ "type": "expression", "expression": { "type": "property_name", "property_name": "name" }, "column_id": "location_name", "display_name": "location_name", "datatype": "string" }], ) self.data_source_config.validate() self.data_source_config.save() self.pillow = get_location_pillow(ucr_configs=[self.data_source_config]) self.pillow.get_change_feed().get_latest_offsets()
def setUpClass(cls): super(TestExpandedColumn, cls).setUpClass() cls.data_source_config = DataSourceConfiguration( domain=cls.domain, display_name='foo', referenced_doc_type='CommCareCase', table_id=clean_table_name(cls.domain, str(uuid.uuid4().hex)), configured_filter={ "type": "boolean_expression", "operator": "eq", "expression": { "type": "property_name", "property_name": "type" }, "property_value": cls.case_type, }, configured_indicators=[{ "type": "expression", "expression": { "type": "property_name", "property_name": field }, "column_id": field, "display_name": field, "datatype": "string" } for field in ['my_field', 'field_name_with_CAPITAL_letters']], ) cls.data_source_config.save()
def setUp(self): self.domain_obj = create_domain(self.domain) es = get_es_new() initialize_index_and_mapping(es, USER_INDEX_INFO) self.region = LocationType.objects.create(domain=self.domain, name="region") self.town = LocationType.objects.create(domain=self.domain, name="town", parent_type=self.region) self.data_source_config = DataSourceConfiguration( domain=self.domain, display_name='Locations in Westworld', referenced_doc_type='Location', table_id=clean_table_name(self.domain, str(uuid.uuid4().hex)), configured_filter={}, configured_indicators=[{ "type": "expression", "expression": { "type": "property_name", "property_name": "name" }, "column_id": "location_name", "display_name": "location_name", "datatype": "string" }], ) self.data_source_config.validate() self.data_source_config.save() self.pillow = get_location_pillow(ucr_configs=[self.data_source_config]) self.pillow.get_change_feed().get_latest_offsets()
def setUpClass(cls): super(TestExpandedColumn, cls).setUpClass() cls.data_source_config = DataSourceConfiguration( domain=cls.domain, display_name='foo', referenced_doc_type='CommCareCase', table_id=clean_table_name(cls.domain, str(uuid.uuid4().hex)), configured_filter={ "type": "boolean_expression", "operator": "eq", "expression": { "type": "property_name", "property_name": "type" }, "property_value": cls.case_type, }, configured_indicators=[{ "type": "expression", "expression": { "type": "property_name", "property_name": field }, "column_id": field, "display_name": field, "datatype": "string" } for field in ['my_field', 'field_name_with_CAPITAL_letters']], ) cls.data_source_config.save()
def _make_config(indicators): return DataSourceConfiguration(domain=domain_name, display_name='foo', referenced_doc_type='CommCareCase', table_id=clean_table_name( domain_name, str(uuid.uuid4().hex)), configured_indicators=indicators)
def _make_config(indicators): return DataSourceConfiguration( domain=domain_name, display_name='foo', referenced_doc_type='CommCareCase', table_id=clean_table_name(domain_name, str(uuid.uuid4().hex)), configured_indicators=indicators )
def get_sample_config(domain=None): return DataSourceConfiguration( domain=domain or 'domain', display_name='foo', referenced_doc_type='CommCareCase', table_id=clean_table_name('domain', str(uuid.uuid4().hex)), configured_indicators=[{ "type": "expression", "expression": { "type": "property_name", "property_name": 'name' }, "column_id": 'name', "display_name": 'name', "datatype": "string" }], )
def get_sample_config(domain=None): return DataSourceConfiguration( domain=domain or 'domain', display_name='foo', referenced_doc_type='CommCareCase', table_id=clean_table_name('domain', str(uuid.uuid4().hex)), configured_indicators=[{ "type": "expression", "expression": { "type": "property_name", "property_name": 'name' }, "column_id": 'name', "display_name": 'name', "datatype": "string" }], )
def setUp(self): self.config = DataSourceConfiguration( domain='domain', display_name='foo', referenced_doc_type='CommCareCase', table_id=clean_table_name('domain', str(uuid.uuid4().hex)), configured_indicators=[{ "type": "expression", "expression": { "type": "property_name", "property_name": 'name' }, "column_id": 'name', "display_name": 'name', "datatype": "string" }], )