本文整理汇总了Python中mock.mock.MagicMock.couch_user方法的典型用法代码示例。如果您正苦于以下问题:Python MagicMock.couch_user方法的具体用法?Python MagicMock.couch_user怎么用?Python MagicMock.couch_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mock.mock.MagicMock
的用法示例。
在下文中一共展示了MagicMock.couch_user方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_extract_value_from_report_table_row_value_input_dict
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_extract_value_from_report_table_row_value_input_dict(self):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'location_id': '',
'program': '',
'month_start': '10',
'year_start': '2017',
'month_end': '3',
'year_end': '2018',
}
dashboard1_report = Dashboard1Report(request=mock, domain='test-pna')
report_table = {
'fix_column': False,
'comment': 'test_comment',
'rows': [],
'datatables': False,
'title': 'test_title',
'total_row': [
{'html': 'row_0'},
{'html': 'row_1'},
{'html': 'row_2'},
{'html': 'row_3'}
],
'slug': 'disponibilite',
'default_rows': 10
}
report_table_value = dashboard1_report._extract_value_from_report_table_row_value(report_table)
self.assertEqual(report_table_value, ['row_0', 'row_1', 'row_2', 'row_3'])
示例2: test_report_data
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_report_data(self):
mock = MagicMock()
mock.couch_user = self.web_user
mock.GET = {
'location_id': 'd1',
'startdate': '2017-11-01',
'enddate': '2017-11-30'
}
mock.datespan = DateSpan(datetime(2017, 11, 1), datetime(2017, 11, 30))
fiche_report = FicheConsommationReport(request=mock, domain='test-domain')
header = fiche_report.headers
rows = fiche_report.rows
self.assertEqual(
[column_group.html for column_group in header],
['', 'Product 1', 'Product 2', 'Product 3']
)
self.assertEqual(
rows,
[
[
'PPS 1',
{'sort_key': 10, 'html': 10}, {'sort_key': 5, 'html': 5}, {'sort_key': 5, 'html': 5},
{'sort_key': 2, 'html': 2}, {'sort_key': 2, 'html': 2}, {'sort_key': 0, 'html': 0},
{'sort_key': 6, 'html': 6}, {'sort_key': 4, 'html': 4}, {'sort_key': 2, 'html': 2}
],
[
'PPS 2',
{'sort_key': 13, 'html': 13}, {'sort_key': 11, 'html': 11}, {'sort_key': 2, 'html': 2},
{'sort_key': 0, 'html': 0}, {'sort_key': 0, 'html': 0}, {'sort_key': 0, 'html': 0},
{'sort_key': 150, 'html': 150}, {'sort_key': 11, 'html': 11}, {'sort_key': 139, 'html': 139}
]
]
)
示例3: test_expiration_rate_report
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_expiration_rate_report(self):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'location_id': '',
'program': '',
'month_start': '10',
'year_start': '2017',
'month_end': '3',
'year_end': '2018',
}
dashboard2_report = Dashboard2Report(request=mock, domain='test-pna')
expiration_rate_report = dashboard2_report.report_context['reports'][1]['report_table']
headers = expiration_rate_report['headers'].as_export_table[0]
rows = expiration_rate_report['rows']
total_row = expiration_rate_report['total_row']
self.assertEqual(
headers,
['R\xe9gion', 'Octobre 2017', 'Novembre 2017', 'D\xe9cembre 2017', 'Janvier 2018',
'F\xe9vrier 2018', 'Mars 2018', 'Taux moyen']
)
self.assertEqual(
rows,
sorted([
[{'html': 'Dakar'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}],
[{'html': 'Fatick'}, {'html': 'pas de donn\xe9es'},
{'style': 'color: red', 'html': '7.75%'}, {'style': '', 'html': '3.59%'},
{'style': '', 'html': '3.51%'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '2.70%'}, {'style': 'color: red', 'html': '5.11%'}],
[{'html': 'Region 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}],
[{'html': 'Region Test'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}],
[{'html': 'Saint-Louis'}, {'style': 'color: red', 'html': '6.50%'},
{'style': 'color: red', 'html': '8.55%'}, {'style': '', 'html': '0.00%'},
{'html': 'pas de donn\xe9es'}, {'style': '', 'html': '1.12%'},
{'html': 'pas de donn\xe9es'}, {'style': '', 'html': '4.93%'}],
[{'html': 'Thies'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}]
], key=lambda x: x[0]['html'])
)
self.assertEqual(
total_row,
[
{'html': 'Taux par Pays'}, {'style': 'color: red', 'html': '6.50%'},
{'style': 'color: red', 'html': '8.17%'}, {'style': '', 'html': '2.34%'},
{'style': '', 'html': '3.51%'}, {'style': '', 'html': '1.12%'},
{'style': '', 'html': '2.70%'}, {'style': '', 'html': '5.00%'}
]
)
示例4: test_recovery_rate_by_pps_report_country_level
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_recovery_rate_by_pps_report_country_level(self):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'location_id': '',
'program': '',
'month_start': '10',
'year_start': '2017',
'month_end': '3',
'year_end': '2018',
}
dashboard2_report = Dashboard2Report(request=mock, domain='test-pna')
recovery_rate_by_pps_report = dashboard2_report.report_context['reports'][3]['report_table']
headers = recovery_rate_by_pps_report['headers'].as_export_table[0]
rows = recovery_rate_by_pps_report['rows']
total_row = recovery_rate_by_pps_report['total_row']
self.assertEqual(
headers,
['Région', 'Octobre 2017', 'Novembre 2017', 'Décembre 2017', 'Janvier 2018',
'Février 2018', 'Mars 2018', 'Taux moyen']
)
self.assertEqual(
rows,
sorted([
[{'html': 'Dakar'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': '0.00%'}, {'html': '0.00%'}],
[{'html': 'Fatick'}, {'html': 'pas de donn\xe9es'}, {'html': '90.47%'}, {'html': '2.75%'},
{'html': '0.00%'}, {'html': 'pas de donn\xe9es'}, {'html': '0.00%'}, {'html': '29.88%'}],
[{'html': 'Region 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': '92.31%'}, {'html': '92.31%'}],
[{'html': 'Region Test'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': '64.98%'},
{'html': 'pas de donn\xe9es'}, {'html': '64.98%'}],
[{'html': 'Saint-Louis'}, {'html': '78.36%'}, {'html': '87.68%'}, {'html': '0.00%'},
{'html': 'pas de donn\xe9es'}, {'html': '0.00%'}, {'html': 'pas de donn\xe9es'},
{'html': '65.73%'}],
[{'html': 'Thies'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': '100.00%'}, {'html': '100.00%'}]
], key=lambda x: x[0]['html'])
)
self.assertEqual(
total_row,
[
{'html': 'Taux par Pays'}, {'html': '78.36%'}, {'html': '88.53%'}, {'html': '1.59%'},
{'html': '0.00%'}, {'html': '15.90%'}, {'html': '22.13%'}, {'html': '54.80%'}
]
)
示例5: test_availability_report_pps_level
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_availability_report_pps_level(self):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'location_id': 'ccf4430f5c3f493797486d6ce1c39682',
'program': '',
'month_start': '10',
'year_start': '2017',
'month_end': '3',
'year_end': '2018',
}
dashboard1_report = Dashboard1Report(request=mock, domain='test-pna')
availability_report = dashboard1_report.report_context['reports'][0]['report_table']
headers = availability_report['headers'].as_export_table[0]
rows = availability_report['rows']
total_row = availability_report['total_row']
self.assertEqual(
headers,
['PPS', 'Octobre 2017', 'Novembre 2017', 'Décembre 2017', 'Janvier 2018',
'Février 2018', 'Mars 2018', 'Taux moyen de disponibilité']
)
self.assertEqual(
rows,
sorted([
[
{'html': 'P2'},
{'style': '', 'html': '100%'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100%'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'}
]
], key=lambda x: x[0])
)
self.assertEqual(
total_row,
[
{'html': 'Disponibilit\xe9 (%)'},
{'style': '', 'html': '100.00%'},
{'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'},
{'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'}
]
)
示例6: test_recap_passage_report
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_recap_passage_report(self):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'month': '07',
'year': '2014',
'location_id': '1991b4dfe166335e342f28134b85fcac',
}
mock.datespan = DateSpan(datetime.datetime(2014, 6, 1), datetime.datetime(2014, 6, 30))
recap_passage_report2 = RecapPassageReport2(request=mock, domain='test-pna')
recap_passage_report2_first = recap_passage_report2.report_context['reports'][0]['report_table']
headers = recap_passage_report2_first['headers'].as_export_table[0]
rows = recap_passage_report2_first['rows']
title = recap_passage_report2_first['title']
self.assertEqual(
title,
'Recap Passage 2014-07-22'
)
self.assertEqual(
headers,
[
'Designations', 'Stock apres derniere livraison',
'Stock disponible et utilisable a la livraison',
'Livraison', 'Stock Total', 'Precedent', 'Recu hors entrepots mobiles', 'Non Facturable',
'Facturable', 'Reelle', 'Stock Total', 'PPS Restant', 'Pertes et Adjustement'
]
)
self.assertEqual(
rows,
[
['CU', 3, 3, 2, 5, 0, 0, 0, 0, 0, 5, 0, 0],
['DIU', 2, 2, 3, 5, 0, 0, 0, 0, 0, 5, 0, 0],
['Depo-Provera', 60, 52, 25, 77, 0, 0, 0, 8, 8, 77, -8, 0],
['Jadelle', 6, 6, 5, 11, 0, 0, 0, 0, 0, 11, 0, 0],
['Microgynon/Lof.', 42, 42, 0, 42, 0, 0, 0, 0, 0, 42, 0, 0],
['Microlut/Ovrette', 15, 12, 18, 30, 0, 0, 0, 3, 3, 30, -3, 0],
['Preservatif Feminin', 5, 5, 0, 5, 0, 0, 0, 0, 0, 5, 0, 0],
['Preservatif Masculin', 100, 100, 0, 100, 0, 0, 0, 0, 0, 100, 0, 0]
]
)
示例7: test_recovery_rate_by_pps_report_pps_level
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_recovery_rate_by_pps_report_pps_level(self):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'location_id': 'ccf4430f5c3f493797486d6ce1c39682',
'program': '',
'month_start': '10',
'year_start': '2017',
'month_end': '3',
'year_end': '2018',
}
dashboard2_report = Dashboard2Report(request=mock, domain='test-pna')
recovery_rate_by_pps_report = dashboard2_report.report_context['reports'][2]['report_table']
headers = recovery_rate_by_pps_report['headers'].as_export_table[0]
rows = recovery_rate_by_pps_report['rows']
total_row = recovery_rate_by_pps_report['total_row']
self.assertEqual(
headers,
['PPS', 'Octobre 2017', 'Novembre 2017', 'D\xe9cembre 2017', 'Janvier 2018', 'F\xe9vrier 2018',
'Mars 2018', 'Taux moyen']
)
self.assertEqual(
rows,
sorted([
[{'html': 'P2'}, {'html': '93.02%'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': '0.00%'},
{'html': 'pas de donn\xe9es'}, {'html': '42.55%'}]
], key=lambda x: x[0])
)
self.assertEqual(
total_row,
[
{'html': 'Taux par PPS'}, {'html': '93.02%'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': '0.00%'},
{'html': 'pas de donn\xe9es'}, {'html': '42.55%'}
]
)
示例8: test_asha_functionality_checklist_report
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_asha_functionality_checklist_report(self, mock_run_query):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'lang': '',
'sf': '',
'startdate': '2018-01-01',
'enddate': '2018-01-31',
'hierarchy_af': '646eb23165f2f3ee9966b0512efc9494',
'month': '01',
'year': '2018',
'hierarchy_district': 'kaushambi',
'hierarchy_block': 'Chail',
}
asha_functionality_checklist_report = ASHAFunctionalityChecklistReport(request=mock, domain='up-nrhm')
rows = asha_functionality_checklist_report.rows
self.assertEqual(
rows,
[
['', 'Date when cheklist was filled', 'Total no. of ASHAs functional on each tasks'],
[1, 'Newborn visits within first day of birth in case of home deliveries', 0],
[2,
'Set of home visits for newborn care as specified in the HBNC guidelines (six visits in case '
'of Institutional delivery and seven in case of a home delivery)',
0],
[3, 'Attending VHNDs/Promoting immunization', 0], [4, 'Supporting institutional delivery', 0],
[5, 'Management of childhood illness - especially diarrhea and pneumonia', 0],
[6, 'Household visits with nutrition counseling', 0],
[7, 'Fever cases seen/malaria slides made in malaria endemic area', 0],
[8, 'Acting as DOTS provider', 0], [9, 'Holding or attending village/VHSNC meeting', 0],
[10,
'Successful referral of the IUD, female sterilization or male sterilization cases and/or '
'providing OCPs/Condoms',
0],
['', 'Total of number of tasks on which ASHA reported being functional', ''],
['', 'Total number of ASHAs who are functional on at least 60% of the tasks', 0],
['', 'Remark', '']
]
)
示例9: test_valuation_of_pna_stock_per_product_data_report
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_valuation_of_pna_stock_per_product_data_report(self):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'location_id': '',
'program': '',
'month_start': '10',
'year_start': '2017',
'month_end': '3',
'year_end': '2018',
}
dashboard3_report = Dashboard3Report(request=mock, domain='test-pna')
valuation_of_pna_stock_per_product_data_report = \
dashboard3_report.report_context['reports'][1]['report_table']
headers = valuation_of_pna_stock_per_product_data_report['headers'].as_export_table[0]
rows = valuation_of_pna_stock_per_product_data_report['rows']
total_row = valuation_of_pna_stock_per_product_data_report['total_row']
self.assertEqual(
headers,
['Produit', 'Octobre 2017', 'Novembre 2017', 'Décembre 2017', 'Janvier 2018',
'Février 2018', 'Mars 2018']
)
self.assertItemsEqual(
rows,
sorted([
['Produit A', '442.500', '717.500', '412.500', '150.000', '437.500', '150.000'],
['Produit B', '336.000', '558.000', '334.500', '157.500', '453.000', '127.500'],
['Produit C', '198.000', '386.400', 'pas de donn\xe9es', '120.000', 'pas de donn\xe9es',
'pas de donn\xe9es'],
], key=lambda x: x[0])
)
self.assertEqual(
total_row,
['Total (CFA)', '976.500', '1.661.900', '747.000', '427.500', '890.500', '277.500']
)
示例10: test_availability_report
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_availability_report(self):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'location_id': '',
'program': '',
'month_start': '10',
'year_start': '2017',
'month_end': '3',
'year_end': '2018',
}
dashboard1_report = Dashboard1Report(request=mock, domain='test-pna')
availability_report = dashboard1_report.report_context['reports'][0]['report_table']
headers = availability_report['headers'].as_export_table[0]
rows = availability_report['rows']
total_row = availability_report['total_row']
self.assertEqual(
headers,
['Région', 'Octobre 2017', 'Novembre 2017', 'Décembre 2017', 'Janvier 2018',
'Février 2018', 'Mars 2018', 'Taux moyen de disponibilité']
)
self.assertEqual(
rows,
sorted([
[
{'html': 'Dakar'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': '100.00%'}
],
[
{'html': 'Fatick'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': 'color: red', 'html': '33.33%'},
{'style': '', 'html': '100.00%'},
{'style': 'color: red', 'html': '0.00%'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'},
{'style': 'color: red', 'html': '58.33%'}
],
[
{'html': 'Region 1'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': 'color: red', 'html': '50.00%'},
{'style': 'color: red', 'html': '50.00%'}
],
[
{'html': 'Region Test'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'}
],
[
{'html': 'Saint-Louis'},
{'style': 'color: red', 'html': '75.00%'},
{'style': 'color: red', 'html': '33.33%'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': 'color: red', 'html': '77.08%'}
],
[
{'html': 'Thies'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': 'color: red', 'html': '87.50%'},
{'style': 'color: red', 'html': '87.50%'}
]
], key=lambda x: x[0]['html'])
)
self.assertEqual(
total_row,
[
{'html': 'Disponibilit\xe9 (%)'},
{'style': 'color: red', 'html': '90.00%'},
{'style': 'color: red', 'html': '33.33%'},
{'style': '', 'html': '100.00%'},
{'style': 'color: red', 'html': '80.00%'},
{'style': '', 'html': '100.00%'},
{'style': 'color: red', 'html': '88.24%'},
{'style': 'color: red', 'html': '83.67%'}
#.........这里部分代码省略.........
示例11: test_rupture_rate_by_pps_report
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_rupture_rate_by_pps_report(self):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'location_id': '',
'program': '',
'month_start': '10',
'year_start': '2017',
'month_end': '3',
'year_end': '2018',
}
dashboard1_report = Dashboard1Report(request=mock, domain='test-pna')
rupture_rate_by_pps_report = dashboard1_report.report_context['reports'][1]['report_table']
headers = rupture_rate_by_pps_report['headers'].as_export_table[0]
rows = rupture_rate_by_pps_report['rows']
total_row = rupture_rate_by_pps_report['total_row']
self.assertEqual(
headers,
['PPS', 'Octobre 2017', 'Novembre 2017', 'Décembre 2017', 'Janvier 2018',
'Février 2018', 'Mars 2018', 'Taux moyen']
)
expected = [
[{'html': 'District Test 2'}, {'style': '', 'html': '0.00%'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'style': '', 'html': '0.00%'}],
[{'html': 'F1'}, {'html': 'pas de donn\xe9es'}, {'style': 'color: red', 'html': '50.00%'},
{'style': '', 'html': '0.00%'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': 'color: red', 'html': '16.67%'}],
[{'html': 'F2'}, {'html': 'pas de donn\xe9es'}, {'style': '', 'html': '0.00%'},
{'style': '', 'html': '0.00%'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'style': '', 'html': '0.00%'}],
[{'html': 'G1'}, {'html': 'pas de donn\xe9es'}, {'style': 'color: red', 'html': '66.67%'},
{'html': 'pas de donn\xe9es'}, {'style': 'color: red', 'html': '33.33%'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': 'color: red', 'html': '50.00%'}],
[{'html': 'Ngor'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'style': '', 'html': '0.00%'}],
[{'html': 'P1'}, {'style': 'color: red', 'html': '33.33%'},
{'style': 'color: red', 'html': '50.00%'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': 'color: red', 'html': '37.50%'}],
[{'html': 'P2'}, {'style': '', 'html': '0.00%'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'style': '', 'html': '0.00%'},
{'html': 'pas de donn\xe9es'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': 'color: red', 'html': '46.15%'}, {'html': 'pas de donn\xe9es'},
{'style': 'color: red', 'html': '46.15%'}],
[{'html': 'PPS 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}],
[{'html': 'PPS 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 1'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}],
[{'html': 'PPS 2'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'style': '', 'html': '0.00%'},
{'html': 'pas de donn\xe9es'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 2'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 2'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 3'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': '', 'html': '0.00%'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 3'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'style': '', 'html': '0.00%'},
{'html': 'pas de donn\xe9es'}, {'style': '', 'html': '0.00%'}],
[{'html': 'PPS 3'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
{'style': 'color: red', 'html': '50.00%'}, {'style': 'color: red', 'html': '50.00%'}],
[{'html': 'PPS Alexis'}, {'html': 'pas de donn\xe9es'}, {'html': 'pas de donn\xe9es'},
#.........这里部分代码省略.........
示例12: test_block_level_af_report
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_block_level_af_report(self, mock_run_query):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'lang': '',
'sf': 'sf4',
'startdate': '2018-01-01',
'enddate': '2018-01-31',
'hierarchy_af': '646eb23165f2f3ee9966b0512efc9494',
'month': '01',
'year': '2018',
'hierarchy_district': 'kaushambi',
'hierarchy_block': 'Chail',
}
block_level_af_report = BlockLevelAFReport(request=mock, domain='up-nrhm')
rows = block_level_af_report.rows
expected = (
[
[
'Newborn visits within first day of birth in case of home deliveries',
{'sort_key': '0', 'html': '0'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '2', 'html': '2'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '1', 'html': '1'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '1', 'html': '1'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '0', 'html': '0'}, {'sort_key': 4.0, 'html': 4.0}
],
[
'Set of home visits for newborn care as specified in the HBNC guidelines<br/>'
'(six visits in case of Institutional delivery and seven in case of a home delivery)',
{'sort_key': '5', 'html': '5'}, {'sort_key': '3', 'html': '3'},
{'sort_key': '5', 'html': '5'}, {'sort_key': '3', 'html': '3'},
{'sort_key': '4', 'html': '4'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '3', 'html': '3'}, {'sort_key': '2', 'html': '2'},
{'sort_key': '3', 'html': '3'}, {'sort_key': 32.0, 'html': 32.0}
],
[
'Attending VHNDs/Promoting immunization',
{'sort_key': '6', 'html': '6'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '5', 'html': '5'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '5', 'html': '5'}, {'sort_key': '5', 'html': '5'},
{'sort_key': '5', 'html': '5'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '5', 'html': '5'}, {'sort_key': 43.0, 'html': 43.0}
],
[
'Supporting institutional delivery',
{'sort_key': '4', 'html': '4'}, {'sort_key': '1', 'html': '1'},
{'sort_key': '4', 'html': '4'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '5', 'html': '5'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '4', 'html': '4'}, {'sort_key': '3', 'html': '3'},
{'sort_key': '3', 'html': '3'}, {'sort_key': 32.0, 'html': 32.0}
],
[
'Management of childhood illness - especially diarrhea and pneumonia',
{'sort_key': '5', 'html': '5'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '4', 'html': '4'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '3', 'html': '3'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '4', 'html': '4'}, {'sort_key': '3', 'html': '3'},
{'sort_key': '3', 'html': '3'}, {'sort_key': 34.0, 'html': 34.0}
],
[
'Household visits with nutrition counseling',
{'sort_key': '4', 'html': '4'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '3', 'html': '3'}, {'sort_key': '3', 'html': '3'},
{'sort_key': '3', 'html': '3'}, {'sort_key': '3', 'html': '3'},
{'sort_key': '3', 'html': '3'}, {'sort_key': '3', 'html': '3'},
{'sort_key': '4', 'html': '4'}, {'sort_key': 30.0, 'html': 30.0}
],
[
'Fever cases seen/malaria slides made in malaria endemic area',
{'sort_key': '0', 'html': '0'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '0', 'html': '0'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '0', 'html': '0'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '0', 'html': '0'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '0', 'html': '0'}, {'sort_key': 0.0, 'html': 0.0}],
[
'Acting as DOTS provider',
{'sort_key': '0', 'html': '0'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '0', 'html': '0'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '0', 'html': '0'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '0', 'html': '0'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '0', 'html': '0'}, {'sort_key': 0.0, 'html': 0.0}
],
[
'Holding or attending village/VHSNC meeting',
{'sort_key': '1', 'html': '1'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '0', 'html': '0'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '0', 'html': '0'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '4', 'html': '4'}, {'sort_key': '0', 'html': '0'},
{'sort_key': '3', 'html': '3'}, {'sort_key': 12.0, 'html': 12.0}
],
[
'Successful referral of the IUD, female sterilization or male '
'sterilization cases and/or providing OCPs/Condoms',
{'sort_key': '6', 'html': '6'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '4', 'html': '4'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '5', 'html': '5'}, {'sort_key': '5', 'html': '5'},
{'sort_key': '5', 'html': '5'}, {'sort_key': '4', 'html': '4'},
{'sort_key': '4', 'html': '4'}, {'sort_key': 41.0, 'html': 41.0}
],
[
#.........这里部分代码省略.........
示例13: test_availability_report_with_chosen_program
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_availability_report_with_chosen_program(self):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'location_id': '',
'program': 'a99fe8331e3dbcc127917e41af45ad81',
'month_start': '10',
'year_start': '2017',
'month_end': '3',
'year_end': '2018',
}
dashboard1_report = Dashboard1Report(request=mock, domain='test-pna')
availability_report = dashboard1_report.report_context['reports'][0]['report_table']
headers = availability_report['headers'].as_export_table[0]
rows = availability_report['rows']
total_row = availability_report['total_row']
self.assertEqual(
headers,
['Région', 'Octobre 2017', 'Novembre 2017', 'Décembre 2017', 'Janvier 2018',
'Février 2018', 'Mars 2018', 'Taux moyen de disponibilité']
)
self.assertEqual(
rows,
sorted([
[
{'html': 'Region 1'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': 'color: red', 'html': '50.00%'},
{'style': 'color: red', 'html': '50.00%'}
],
[
{'html': 'Region Test'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'}
],
[
{'html': 'Thies'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': '100.00%'}
]
], key=lambda x: x[0])
)
self.assertEqual(
total_row,
[
{'html': 'Disponibilit\xe9 (%)'},
{'style': '', 'html': '100.00%'},
{'html': 'pas de donn\xe9es'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': '100.00%'},
{'style': '', 'html': '100.00%'},
{'style': 'color: red', 'html': '66.67%'},
{'style': 'color: red', 'html': '91.67%'}
]
)
示例14: test_district_functionality_report
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_district_functionality_report(self, mock_run_query):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'lang': '',
'sf': 'sf5',
'startdate': '2018-01-01',
'enddate': '2018-01-31',
'hierarchy_af': '646eb23165f2f3ee9966b0512efc9494',
'month': '01',
'year': '2018',
'hierarchy_district': 'kaushambi',
'hierarchy_block': 'Chail',
}
district_functionality_report = DistrictFunctionalityReport(request=mock, domain='up-nrhm')
rows = district_functionality_report.rows
expected = (
[
[
'Newborn visits within first day of birth in case of home deliveries',
{'sort_key': '2.8%', 'html': '2.8%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '2.3%', 'html': '2.3%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '0.0%', 'html': '0.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '2.4%', 'html': '2.4%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '2.6%', 'html': '2.6%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '3.0%', 'html': '3.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '3.2%', 'html': '3.2%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '4.7%', 'html': '4.7%'}, {'sort_key': 'D', 'html': 'D'}
],
[
'Set of home visits for newborn care as specified in the HBNC guidelines<br/>'
'(six visits in case of Institutional delivery and seven in case of a home delivery)',
{'sort_key': '22.5%', 'html': '22.5%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '20.9%', 'html': '20.9%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '17.2%', 'html': '17.2%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '21.0%', 'html': '21.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '19.6%', 'html': '19.6%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '21.6%', 'html': '21.6%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '19.0%', 'html': '19.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '20.2%', 'html': '20.2%'}, {'sort_key': 'D', 'html': 'D'}
],
[
'Attending VHNDs/Promoting immunization',
{'sort_key': '30.3%', 'html': '30.3%'}, {'sort_key': 'C', 'html': 'C'},
{'sort_key': '29.5%', 'html': '29.5%'}, {'sort_key': 'C', 'html': 'C'},
{'sort_key': '25.3%', 'html': '25.3%'}, {'sort_key': 'C', 'html': 'C'},
{'sort_key': '29.8%', 'html': '29.8%'}, {'sort_key': 'C', 'html': 'C'},
{'sort_key': '29.6%', 'html': '29.6%'}, {'sort_key': 'C', 'html': 'C'},
{'sort_key': '29.1%', 'html': '29.1%'}, {'sort_key': 'C', 'html': 'C'},
{'sort_key': '28.6%', 'html': '28.6%'}, {'sort_key': 'C', 'html': 'C'},
{'sort_key': '27.1%', 'html': '27.1%'}, {'sort_key': 'C', 'html': 'C'}
],
[
'Supporting institutional delivery',
{'sort_key': '22.5%', 'html': '22.5%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '27.1%', 'html': '27.1%'}, {'sort_key': 'C', 'html': 'C'},
{'sort_key': '20.2%', 'html': '20.2%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '22.6%', 'html': '22.6%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '24.9%', 'html': '24.9%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '24.6%', 'html': '24.6%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '23.0%', 'html': '23.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '17.8%', 'html': '17.8%'}, {'sort_key': 'D', 'html': 'D'}
],
[
'Management of childhood illness - especially diarrhea and pneumonia',
{'sort_key': '23.9%', 'html': '23.9%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '18.6%', 'html': '18.6%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '27.3%', 'html': '27.3%'}, {'sort_key': 'C', 'html': 'C'},
{'sort_key': '20.2%', 'html': '20.2%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '17.5%', 'html': '17.5%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '10.4%', 'html': '10.4%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '24.6%', 'html': '24.6%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '22.5%', 'html': '22.5%'}, {'sort_key': 'D', 'html': 'D'}
],
[
'Household visits with nutrition counseling',
{'sort_key': '21.1%', 'html': '21.1%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '9.3%', 'html': '9.3%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '13.1%', 'html': '13.1%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '0.0%', 'html': '0.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '9.0%', 'html': '9.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '0.7%', 'html': '0.7%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '0.0%', 'html': '0.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '15.5%', 'html': '15.5%'}, {'sort_key': 'D', 'html': 'D'}
],
[
'Fever cases seen/malaria slides made in malaria endemic area',
{'sort_key': '0.0%', 'html': '0.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '0.0%', 'html': '0.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '1.0%', 'html': '1.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '0.0%', 'html': '0.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '0.0%', 'html': '0.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '0.0%', 'html': '0.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '0.0%', 'html': '0.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '0.0%', 'html': '0.0%'}, {'sort_key': 'D', 'html': 'D'}
],
[
'Acting as DOTS provider',
{'sort_key': '0.0%', 'html': '0.0%'}, {'sort_key': 'D', 'html': 'D'},
{'sort_key': '8.5%', 'html': '8.5%'}, {'sort_key': 'D', 'html': 'D'},
#.........这里部分代码省略.........
示例15: test_asha_facilitators_report
# 需要导入模块: from mock.mock import MagicMock [as 别名]
# 或者: from mock.mock.MagicMock import couch_user [as 别名]
def test_asha_facilitators_report(self, mock_run_query):
mock = MagicMock()
mock.couch_user = self.user
mock.GET = {
'lang': '',
'sf': 'sf2',
'startdate': '2018-01-01',
'enddate': '2018-01-31',
'hierarchy_af': '646eb23165f2f3ee9966b0512efc9494',
'month': '01',
'year': '2018',
}
asha_facilitators_report = ASHAFacilitatorsReport(request=mock, domain='up-nrhm')
rows = asha_facilitators_report.rows
expected = (
[
[
'Newborn visits within first day of birth in case of home deliveries', '--',
{'sort_key': 17, 'html': 17}, ''
],
[
'Set of home visits for newborn care as specified in the HBNC guidelines<br/>(six visits '
'in case of Institutional delivery and seven in case of a home delivery)',
'--', {'sort_key': 17, 'html': 17}, ''
],
[
'Attending VHNDs/Promoting immunization', '--', {'sort_key': 17, 'html': 17}, ''
],
[
'Supporting institutional delivery', '--', {'sort_key': 17, 'html': 17}, ''
],
[
'Management of childhood illness - especially diarrhea and pneumonia', '--',
{'sort_key': 17, 'html': 17}, ''
],
[
'Household visits with nutrition counseling', '--', {'sort_key': 17, 'html': 17}, ''
],
[
'Fever cases seen/malaria slides made in malaria endemic area', '--',
{'sort_key': 17, 'html': 17}, ''
],
[
'Acting as DOTS provider', '--', {'sort_key': 17, 'html': 17}, ''
],
[
'Holding or attending village/VHSNC meeting', '--', {'sort_key': 17, 'html': 17}, ''
],
[
'Successful referral of the IUD, female sterilization or male sterilization cases and/or '
'providing OCPs/Condoms',
'--', {'sort_key': 17, 'html': 17}, ''
],
[
'<b>Total number of ASHAs who are functional on at least 60% of the tasks</b>',
{'sort_key': 0.0, 'html': '0/0 (0%)'},
{'sort_key': 17, 'html': 17},
''
]
], 17, 0
)
self.assertEqual(len(rows), len(expected))
self.assertEqual(len(rows[0]), len(expected[0]))
for i in range(len(rows[0])):
self.assertEqual(len(rows[0][i]), len(expected[0][i]))
for record in expected[0][i]:
self.assertIn(record, rows[0][i])