def testBadAggregation(self): with self.assertRaises(BadValueError): ReportColumn.wrap({ "aggregation": "simple_", "field": "doc_id", "type": "field", })
def from_spec(cls, spec): from corehq.apps.userreports.reports.data_source import ConfigurableReportDataSource return ConfigurableReportDataSource( domain=spec.domain, config_or_config_id=spec.config_id, filters=[ReportFilter.wrap(f) for f in spec.filters], aggregation_columns=spec.aggregation_columns, columns=[ReportColumn.wrap(colspec) for colspec in spec.columns], )
def testGoodFormat(self): for format in [ 'default', 'percent_of_total', ]: self.assertEquals(ReportColumn, type( ReportColumn.wrap({ "aggregation": "simple", "field": "doc_id", "format": format, "type": "field", }) ))