本文整理汇总了Python中corehq.apps.userreports.models.StaticReportConfiguration.all方法的典型用法代码示例。如果您正苦于以下问题:Python StaticReportConfiguration.all方法的具体用法?Python StaticReportConfiguration.all怎么用?Python StaticReportConfiguration.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.userreports.models.StaticReportConfiguration
的用法示例。
在下文中一共展示了StaticReportConfiguration.all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_for_report_id_conflicts
# 需要导入模块: from corehq.apps.userreports.models import StaticReportConfiguration [as 别名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 别名]
def test_for_report_id_conflicts(self):
counts = Counter(rc.get_id for rc in
StaticReportConfiguration.all())
duplicates = [k for k, v in counts.items() if v > 1]
msg = "The following report configs have duplicate generated report_ids:\n{}".format(
"\n".join("report_id: {}".format(report_id) for report_id in duplicates)
)
self.assertEqual(0, len(duplicates), msg)
示例2: test_get_all
# 需要导入模块: from corehq.apps.userreports.models import StaticReportConfiguration [as 别名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 别名]
def test_get_all(self):
with override_settings(STATIC_UCR_REPORTS=[self.get_path('static_report_config', 'json')]):
all = list(StaticReportConfiguration.all())
self.assertEqual(2, len(all))
example, dimagi = all
self.assertEqual('example', example.domain)
self.assertEqual('dimagi', dimagi.domain)
for config in all:
self.assertEqual('Custom Title', config.title)
示例3: test_data_sources_actually_exist
# 需要导入模块: from corehq.apps.userreports.models import StaticReportConfiguration [as 别名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 别名]
def test_data_sources_actually_exist(self):
data_sources_on_domain = defaultdict(set)
for data_source in StaticDataSourceConfiguration.all():
data_sources_on_domain[data_source.domain].add(data_source.get_id)
def has_no_data_source(report_config):
available_data_sources = data_sources_on_domain[report_config.domain]
return report_config.config_id not in available_data_sources
all_configs = StaticReportConfiguration.all()
configs_missing_data_source = list(filter(has_no_data_source, all_configs))
msg = ("There are {} report configs which reference data sources that "
"don't exist (or which don't exist on that domain):\n{}".format(
len(configs_missing_data_source),
"\n".join(config.get_id for config in configs_missing_data_source)))
self.assertEqual(0, len(configs_missing_data_source), msg)
示例4: handle
# 需要导入模块: from corehq.apps.userreports.models import StaticReportConfiguration [as 别名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 别名]
def handle(self, **options):
config_ids = get_doc_ids_by_class(ReportConfiguration)
builder_count, ucr_count = 0, 0
for doc in iter_docs(ReportConfiguration.get_db(), config_ids):
if doc['report_meta']['created_by_builder']:
builder_count += 1
else:
ucr_count += 1
static_count = len(list(StaticReportConfiguration.all()))
total_count = builder_count + ucr_count + static_count
print(textwrap.dedent("""
As of {}, on {} there are {} total UCRs:
{} Report Builder Reports
{} UCR Report Configs
{} Static Report Configs enabled for the environment
""".format(datetime.utcnow().date(), settings.SERVER_ENVIRONMENT, total_count,
builder_count, ucr_count, static_count)))
示例5: test_production_config
# 需要导入模块: from corehq.apps.userreports.models import StaticReportConfiguration [as 别名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 别名]
def test_production_config(self):
for data_source in StaticReportConfiguration.all():
data_source.validate()
示例6: test_production_config
# 需要导入模块: from corehq.apps.userreports.models import StaticReportConfiguration [as 别名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 别名]
def test_production_config(self):
for report_config in StaticReportConfiguration.all():
report_config.validate()