def test_fiche_consommation_report(self):
        mock = MagicMock()
        mock.couch_user = self.user
        mock.GET = {
            'startdate': '2014-06-01',
            'enddate': '2014-07-31',
            'location_id': '1991b4dfe166335e342f28134b85fcac',
        }
        mock.datespan = DateSpan(datetime.datetime(2014, 6, 1), datetime.datetime(2014, 7, 31))

        fiche_consommation_report2_report = FicheConsommationReport2(request=mock, domain='test-pna')

        fiche_consommation_report = fiche_consommation_report2_report.report_context['reports'][0]['report_table']
        headers = fiche_consommation_report['headers'].as_export_table[0]
        rows = fiche_consommation_report['rows']
        self.assertEqual(
            headers,
            ['', 'CU', ' ', ' ', 'DIU', ' ', ' ', 'Depo-Provera', ' ', ' ',
             'Jadelle', ' ', ' ', 'Microgynon/Lof.', ' ', ' ', 'Microlut/Ovrette', ' ', ' ',
             'Preservatif Feminin', ' ', ' ', 'Preservatif Masculin', ' ', ' ']
        )
        self.assertEqual(
            rows,
            [['LERANE COLY', 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0]]
        )
示例#2
0
    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
0
    def test_conventure_report(self):
        mock = MagicMock()
        mock.couch_user = self.user
        mock.GET = {
            'startdate': '2014-06-01',
            'enddate': '2014-07-31',
            'location_id': '1991b4dfe166335e342f28134b85fcac',
        }
        mock.datespan = DateSpan(datetime.datetime(2014, 6, 1),
                                 datetime.datetime(2014, 7, 31))

        tableu_de_board_report2_report = TableuDeBoardReport2(
            request=mock, domain='test-pna')

        conventure_report = tableu_de_board_report2_report.report_context[
            'reports'][0]['report_table']
        headers = conventure_report['headers'].as_export_table[0]
        rows = conventure_report['rows']

        self.assertEqual(headers, [
            'Mois', 'No de PPS (number of PPS registered in that region)',
            'No de PPS planifie (number of PPS planned)',
            'No de PPS avec livrasion cet mois (number of PPS visited this month)',
            'Taux de couverture (coverage ratio)',
            'No de PPS avec donnees soumises (number of PPS which submitted data)',
            'Exhaustivite des donnees'
        ])
        self.assertEqual(rows, [['Ao\xfbt', 0, 0, 1, '100.00%', 1, '100.00%']])
示例#4
0
    def test_consommation_data_report(self):
        mock = MagicMock()
        mock.couch_user = self.user
        mock.GET = {
            'startdate': '2016-05-28',
            'enddate': '2018-06-04',
            'location_id': '',
        }
        mock.datespan = DateSpan(datetime.datetime(2016, 5, 28),
                                 datetime.datetime(2018, 6, 4))

        tableu_de_board_report2_report = TableuDeBoardReport2(
            request=mock, domain='test-pna')

        consommation_data_report = tableu_de_board_report2_report.report_context[
            'reports'][3]['report_table']
        headers = consommation_data_report['headers'].as_export_table[0]
        rows = consommation_data_report['rows']

        self.assertEqual(headers, [
            'PPS', 'ACT Adulte', 'ACT Grand Enfant', 'ACT Nourisson',
            'ACT Petit Enfant', 'Amoxicilline 250mg SP', 'Ampiciline 1G Amp',
            'CU', u'Calcium 100mg', 'Cefixime 100MG/5ML SUSP.BUV',
            'Ceftriaxone 1G', 'Collier', 'DIU', u'Depo-Provera',
            'Dexamethasone 4mg', 'Diazepam 10MG/2ML AMP. INJ.',
            'Epinephrine 1MG/1ML AMP. INJ.', 'Fer 0.68% SP',
            'Gentamicin INJ 80mg/2ml', 'Hydrocortisone 100MG AMP. INJ.',
            'IMPLANON', 'Jadelle', 'Kit de depistage Rapide du VIH B/30',
            'Mebendazole 100MG SP', 'Mebendazole 500MG CP.', 'Microgynon/Lof.',
            'Microlut/Ovrette', 'Oxytocine 5 UI', 'Paracetamol 120MG/5ML SP',
            'Paracetamol 1G/100ML INJ.', 'Phytomenadione 10mg',
            'Preservatif Feminin', 'Preservatif Masculin', 'Recto caps 200 mg',
            'Recto caps 50 mg', 'S.R.O. Faible osmolarite', 'Sayana Press',
            'Sulfate de Magnesium 20 ml', 'Test depistage rapide Palu',
            u'Zinc 20mg'
        ])
        self.assertEqual(
            sorted(rows, key=lambda x: x[0]),
            sorted([[
                'GATE', 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,
                0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0
            ],
                    [
                        None, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                        1, 1, 1, 1, 1
                    ]],
                   key=lambda x: x[0]))
    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]
            ]
        )
示例#6
0
    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
             ]])
    def test_fiche_consommation_report_countrywide(self):
        mock = MagicMock()
        mock.couch_user = self.user
        mock.GET = {
            'startdate': '2014-06-01',
            'enddate': '2014-07-31',
            'location_id': '',
        }
        mock.datespan = DateSpan(datetime.datetime(2014, 6, 1), datetime.datetime(2014, 7, 31))

        fiche_consommation_report2_report = FicheConsommationReport2(request=mock, domain='test-pna')

        fiche_consommation_report = fiche_consommation_report2_report.report_context['reports'][0]['report_table']
        headers = fiche_consommation_report['headers'].as_export_table[0]
        rows = fiche_consommation_report['rows']
        self.assertEqual(
            headers,
            ['', 'CU', ' ', ' ', 'Collier', ' ', ' ', 'DIU', ' ', ' ', 'Depo-Provera', ' ', ' ',
             'Jadelle', ' ', ' ', 'Microgynon/Lof.', ' ', ' ', 'Microlut/Ovrette', ' ', ' ',
             'Preservatif Feminin', ' ', ' ', 'Preservatif Masculin', ' ', ' ']
        )
        self.assertEqual(
            rows,
            [
                ['DEBI TIQUET', 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0],
                ['DIOGO', 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0],
                ['LERANE COLY', 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0],
                ['NDIAWAR RICHARD TOLL', 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0,
                 1, 1, 0],
                ['NIANGUE DIAW', 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0],
                ['PS CAMP MILITAIRE', 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1,
                 1, 0],
                ['PS DIOKOUL WAGUE', 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1,
                 0],
                ['PS NGOR', 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0],
                ['PS PLLES ASS. UNITE 12', 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0,
                 1, 1, 0]
            ]
        )
示例#8
0
    def test_PPS_avec_donnees_report(self):
        mock = MagicMock()
        mock.couch_user = self.user
        mock.GET = {
            'startdate': '2014-06-01',
            'enddate': '2014-07-31',
            'location_id': '1991b4dfe166335e342f28134b85fcac',
        }
        mock.datespan = DateSpan(datetime.datetime(2014, 6, 1),
                                 datetime.datetime(2014, 7, 31))

        tableu_de_board_report2_report = TableuDeBoardReport2(
            request=mock, domain='test-pna')

        PPS_avec_donnees_report = tableu_de_board_report2_report.report_context[
            'reports'][1]['report_table']
        headers = PPS_avec_donnees_report['headers'].as_export_table[0]
        rows = PPS_avec_donnees_report['rows']

        self.assertEqual(headers, ['PPS', 'PPS Avec Donn\xe9es Soumises'])
        self.assertEqual(sorted(rows, key=lambda x: x[0]),
                         sorted([['PASSY', 1]], key=lambda x: x[0]))
示例#9
0
    def test_products_report(self):
        mock = MagicMock()
        mock.couch_user = self.user
        mock.GET = {
            'startdate': '2014-06-01',
            'enddate': '2014-07-31',
            'location_id': '',
        }
        mock.datespan = DateSpan(datetime.datetime(2014, 6, 1),
                                 datetime.datetime(2014, 7, 31))

        tableu_de_board_report2_report = TableuDeBoardReport2(
            request=mock, domain='test-pna')

        products_report = tableu_de_board_report2_report.report_context[
            'reports'][2]['report_table']
        headers = products_report['headers'].as_export_table[0]
        rows = products_report['rows']
        self.assertEqual(headers, [
            'Quantity', 'ACT Adulte', 'ACT Grand Enfant', 'ACT Nourisson',
            'ACT Petit Enfant', 'ASAQ Adulte', 'ASAQ Grand Enfant',
            'ASAQ Petit Enfant', 'Amoxicillin 250mg', 'Ampiciline 1G Amp',
            'Bo\xeete de s\xe9curit\xe9', 'CU', u'Calcium 100mg',
            'Cefixime 100MG/5ML SUSP.BUV', 'Ceftriaxone 1G', 'Chlorexedine',
            'Collier', 'DIU', 'Depo-Provera', 'Dexamethasone 4mg',
            'Diazepam 10MG/2ML AMP. INJ.', 'Diluant BCG',
            'Diluant Fi\xe8vre Jaune (VAA)', 'Diluant Rougeole (RR)',
            'EFAVIRENZ 600MG CP.', 'Epinephrine 1MG/1ML AMP. INJ.',
            'Fer 0.68% SP', 'Gentamicin 40mg/2ml',
            'Hydrocortisone 100MG AMP. INJ.', 'IMPLANON',
            'ISONIAZIDE 100MG CP.', 'Jadelle',
            'Kit de depistage Rapide du VIH B/30',
            'LAMIVUDINE 30 NEVIRAPINE 50 ZIDOVUDINE 60 MG CP.',
            'Magnesium sulfate 500mg', 'Mebendazole 100MG SP',
            'Mebendazole 500MG CP.', 'Microgynon/Lof.', 'Microlut/Ovrette',
            'Misoprostol 200mcg', 'NEVIRAPINE 200MG CP', 'Oxytocine 5 UI',
            'Paracetamol 120MG/5ML SP', 'Paracetamol 1G/100ML INJ.',
            'Phytomenadione 10mg', 'Pneumo', 'Preservatif Feminin',
            'Preservatif Masculin', 'Product 7',
            'RIFAMPICINE 150 ISONIAZIDE 75MG CP.',
            'RIFAMPICINE 60 ISONIAZIDE 30MG CP. DISPERSIBLE',
            'RIFAMPICINE150 ISONIAZIDE 75 PYRAZINAMIDE400 ETHAMBUTOL2',
            'RIFAMPICINE60 ISONIAZIDE30 PYRAZINAMIDE150MG CP.DISPER',
            'Recto caps 200 mg', 'Recto caps 50 mg', 'Rota',
            'S.R.O. Faible osmolarite', 'STREPTOMYCINE 1G AMP. INJ.',
            'Sayana Press', 'Seringue Autobloquante 0,05 ml',
            'Seringue Autobloquante 0,5 ml', 'Seringue de dilution 2 ML',
            'Seringue de dilution 5 ML (SD)',
            'TENOFOVIR 300 LAMIVUDINE 300 EFAVIRENZ  600 MG CP.',
            'TENOFOVIR 300 LAMIVUDINE 300MG CP.', 'Test depistage rapide Palu',
            u'Tubercoline', 'Vaccin BCG', 'Vaccin DIPH - T\xe9tanique (Td)',
            'Vaccin Fi\xe8vre Jaune (VAA)', 'Vaccin H\xe9patite B',
            'Vaccin Penta', 'Vaccin Rougeole (RR)', 'Vaccin VPI', 'Vaccin VPO',
            'ZIDOVUDINE 300 LAMIVUDINE 150MG CP', 'Zinc 20mg'
        ])
        self.assertEqual(
            rows, [[
                'Commandes', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1842, 0, 0, 0, 0,
                217, 2194, 90675, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7510, 0,
                0, 0, 0, 0, 113080, 7200, 0, 0, 0, 0, 0, 0, 0, 4000, 48000, 0,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 0, 0
            ],
                   [
                       'Raux', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1842, 0, 0, 0, 0,
                       217, 2194, 51308, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                       5810, 0, 0, 0, 0, 0, 59080, 7200, 0, 0, 0, 0, 0, 0, 0,
                       4000, 48000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                   ],
                   [
                       'Taux', '0%', '0%', '0%', '0%', '0%', '0%', '0%', '0%',
                       '0%', '0%', '100%', '0%', '0%', '0%', '0%', '100%',
                       '100%', '176%', '0%', '0%', '0%', '0%', '0%', '0%',
                       '0%', '0%', '0%', '0%', '0%', '0%', '129%', '0%', '0%',
                       '0%', '0%', '0%', '191%', '100%', '0%', '0%', '0%',
                       '0%', '0%', '0%', '0%', '100%', '100%', '0%', '0%',
                       '0%', '0%', '0%', '0%', '0%', '0%', '0%', '0%', '0%',
                       '0%', '0%', '0%', '0%', '0%', '0%', '0%', '0%', '0%',
                       '0%', '0%', '0%', '0%', '0%', '0%', '0%', '0%', '0%'
                   ]])
示例#10
0
    def test_recap_passage_report_countrywide(self):
        mock = MagicMock()
        mock.couch_user = self.user
        mock.GET = {
            'month': '06',
            'year': '2014',
            'location_id': '',
        }
        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']
        recap_passage_report2_second = recap_passage_report2.report_context[
            'reports'][1]['report_table']
        self.assertEqual(title, 'Recap Passage 2014-06-10')
        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', 12, 12, 0, 12, 0, 0, 0, 0, 0, 12, 0, 0],
            ['Collier', 9, 9, 0, 9, 4, 0, 0, 0, 0, 9, 4, 0],
            ['DIU', 21, 7, 30, 37, 0, 0, 0, 14, 14, 37, -14, 0],
            [
                'Depo-Provera', 791, 606, 0, 606, 0, 0, 0, 185, 185, 606, -185,
                0
            ],
            ['Jadelle', 45, 28, 20, 48, 0, 0, 0, 17, 17, 48, -17, 0],
            [
                'Microgynon/Lof.', 801, 522, 160, 682, 0, 0, 0, 279, 279, 682,
                -279, 0
            ],
            [
                'Microlut/Ovrette', 234, 197, 0, 197, 0, 0, 0, 37, 37, 197,
                -37, 0
            ],
            [
                'Preservatif Feminin', 20, 10, 10, 20, 0, 0, 0, 10, 10, 20,
                -10, 0
            ],
            [
                'Preservatif Masculin', 279, 258, 100, 358, 68, 0, 21, 0, 21,
                358, 47, 0
            ],
        ])
        headers = recap_passage_report2_second['headers'].as_export_table[0]
        rows = recap_passage_report2_second['rows']
        title = recap_passage_report2_second['title']
        self.assertEqual(title, 'Recap Passage 2014-06-11')
        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', 10, 9, 0, 9, 0, 0, 0, 1, 1, 9, -1, 0],
            ['Collier', 6, 6, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0],
            ['DIU', 6, 6, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0],
            ['Depo-Provera', 160, 145, 0, 145, 0, 0, 0, 15, 15, 145, -15, 0],
            ['Jadelle', 13, 13, 0, 13, 0, 0, 0, 0, 0, 13, 0, 0],
            [
                'Microgynon/Lof.', 189, 156, 0, 156, 0, 0, 0, 33, 33, 156, -33,
                0
            ],
            [
                'Microlut/Ovrette', 100, 88, 18, 106, 0, 0, 0, 12, 12, 106,
                -12, 0
            ],
            ['Preservatif Feminin', 15, 15, 0, 15, 0, 0, 0, 0, 0, 15, 0, 0],
            [
                'Preservatif Masculin', 160, 160, 0, 160, 0, 0, 0, 0, 0, 160,
                0, 0
            ],
        ])
    def test_recap_passage_report_countrywide(self):
        mock = MagicMock()
        mock.couch_user = self.user
        mock.GET = {
            'month': '06',
            'year': '2014',
            'location_id': '',
        }
        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']
        recap_passage_report2_second = recap_passage_report2.report_context['reports'][1]['report_table']
        self.assertEqual(
            title,
            'Recap Passage 2014-06-10'
        )
        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', 12, 12, 0, 12, 0, 0, 0, 0, 0, 12, 0, 0],
                ['Collier', 9, 9, 0, 9, 4, 0, 0, 0, 0, 9, 4, 0],
                ['DIU', 21, 7, 30, 37, 0, 0, 0, 14, 14, 37, -14, 0],
                ['Depo-Provera', 791, 606, 0, 606, 0, 0, 0, 185, 185, 606, -185, 0],
                ['Jadelle', 45, 28, 20, 48, 0, 0, 0, 17, 17, 48, -17, 0],
                ['Microgynon/Lof.', 801, 522, 160, 682, 0, 0, 0, 279, 279, 682, -279, 0],
                ['Microlut/Ovrette', 234, 197, 0, 197, 0, 0, 0, 37, 37, 197, -37, 0],
                ['Preservatif Feminin', 20, 10, 10, 20, 0, 0, 0, 10, 10, 20, -10, 0],
                ['Preservatif Masculin', 279, 258, 100, 358, 68, 0, 21, 0, 21, 358, 47, 0],
            ]
        )
        headers = recap_passage_report2_second['headers'].as_export_table[0]
        rows = recap_passage_report2_second['rows']
        title = recap_passage_report2_second['title']
        self.assertEqual(
            title,
            'Recap Passage 2014-06-11'
        )
        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', 10, 9, 0, 9, 0, 0, 0, 1, 1, 9, -1, 0],
                ['Collier', 6, 6, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0],
                ['DIU', 6, 6, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0],
                ['Depo-Provera', 160, 145, 0, 145, 0, 0, 0, 15, 15, 145, -15, 0],
                ['Jadelle', 13, 13, 0, 13, 0, 0, 0, 0, 0, 13, 0, 0],
                ['Microgynon/Lof.', 189, 156, 0, 156, 0, 0, 0, 33, 33, 156, -33, 0],
                ['Microlut/Ovrette', 100, 88, 18, 106, 0, 0, 0, 12, 12, 106, -12, 0],
                ['Preservatif Feminin', 15, 15, 0, 15, 0, 0, 0, 0, 0, 15, 0, 0],
                ['Preservatif Masculin', 160, 160, 0, 160, 0, 0, 0, 0, 0, 160, 0, 0],
            ]
        )