Exemple #1
0
    def setUpClass(cls):
        super(TestIndicatorPeriodicTask, cls).setUpClass()
        cls.domain_obj = create_domain(cls.domain)

        location_type_structure = [
            LocationTypeStructure('supervisor',
                                  [LocationTypeStructure('awc', [])])
        ]
        location_structure = [
            LocationStructure('LS1', 'supervisor', [
                LocationStructure('AWC1', 'awc', []),
                LocationStructure('AWC2', 'awc', []),
            ]),
            LocationStructure('LS2', 'supervisor', [
                LocationStructure('AWC3', 'awc', []),
                LocationStructure('AWC4', 'awc', []),
            ])
        ]
        cls.loc_types = setup_location_types_with_structure(
            cls.domain, location_type_structure)
        cls.locs = setup_locations_with_structure(cls.domain,
                                                  location_structure)
        cls.ls1 = cls._make_user('ls1', cls.locs['LS1'])
        cls.ls2 = cls._make_user('ls2', cls.locs['LS2'])
        cls.aww1 = cls._make_user('aww1', cls.locs['AWC1'])
        cls.aww2 = cls._make_user('aww2', cls.locs['AWC2'])
        cls.aww3 = cls._make_user('aww3', cls.locs['AWC3'])
        cls.aww4 = cls._make_user('aww4', cls.locs['AWC4'])

        cls.ls_user_ids = [cls.ls1.get_id, cls.ls2.get_id]
        cls.aww_user_ids = [
            cls.aww1.get_id, cls.aww2.get_id, cls.aww3.get_id, cls.aww4.get_id
        ]
Exemple #2
0
def location_data():
    from corehq.apps.locations.tests.util import LocationTypeStructure
    from corehq.apps.locations.tests.util import LocationStructure
    from corehq.apps.locations.tests.util import setup_location_types_with_structure
    from corehq.apps.locations.tests.util import setup_locations_with_structure
    location_type_structure = [LocationTypeStructure('t1', [])]

    location_structure = [
        LocationStructure('L1', 't1', []),
        LocationStructure('L2', 't1', []),
        LocationStructure('L3', 't1', []),
    ]

    with test_domain():
        setup_location_types_with_structure('domain', location_type_structure)
        locs = setup_locations_with_structure('domain', location_structure)

        yield [loc.location_id for name, loc in locs.items()]
Exemple #3
0
    def _setup_enikshay_locations(self, domain_name):
        location_type_structure = [
            LocationTypeStructure('ctd', [
                LocationTypeStructure('sto', [
                    LocationTypeStructure('cto', [
                        LocationTypeStructure('dto', [
                            LocationTypeStructure('tu', [
                                LocationTypeStructure('phi', []),
                                LocationTypeStructure('dmc', []),
                            ]),
                            LocationTypeStructure('drtb-hiv', []),
                        ])
                    ]),
                    LocationTypeStructure('drtb', []),
                    LocationTypeStructure('cdst', []),
                ])
            ])
        ]
        location_structure = [
            LocationStructure('CTD', 'ctd', [
                LocationStructure('STO', 'sto', [
                    LocationStructure('CTO', 'cto', [
                        LocationStructure('DTO', 'dto', [
                            LocationStructure('TU', 'tu', [
                                LocationStructure('PHI', 'phi', []),
                                LocationStructure('DMC', 'dmc', []),
                            ]),
                            LocationStructure('DRTB-HIV', 'drtb-hiv', []),
                        ])
                    ]),
                    LocationStructure('DRTB', 'drtb', []),
                    LocationStructure('CDST', 'cdst', []),
                ])
            ])
        ]

        setup_location_types_with_structure(domain_name,
                                            location_type_structure)
        return setup_locations_with_structure(domain_name, location_structure)
Exemple #4
0
def setup_enikshay_locations(domain_name):
    location_type_structure = [
        LocationTypeStructure('ctd', [
            LocationTypeStructure('sto', [
                LocationTypeStructure('cto', [
                    LocationTypeStructure('dto', [
                        LocationTypeStructure('tu', [
                            LocationTypeStructure('phi', []),
                            LocationTypeStructure('dmc', []),
                        ]),
                        LocationTypeStructure('drtb-hiv', []),
                        LocationTypeStructure('pac', []),
                        LocationTypeStructure('pcc', []),
                        LocationTypeStructure('pcp', []),
                        LocationTypeStructure('pdr', []),
                        LocationTypeStructure('plc', []),
                    ])
                ]),
                LocationTypeStructure('drtb', []),
                LocationTypeStructure('cdst', []),
            ])
        ])
    ]
    location_structure = [
        LocationStructure('CTD', 'ctd', [
            LocationStructure('STO', 'sto', [
                LocationStructure('CTO', 'cto', [
                    LocationStructure('DTO', 'dto', [
                        LocationStructure('TU', 'tu', [
                            LocationStructure('PHI', 'phi', []),
                            LocationStructure('DMC', 'dmc', []),
                        ]),
                        LocationStructure('DRTB-HIV', 'drtb-hiv', []),
                        LocationStructure('PAC', 'pac', []),
                        LocationStructure('PCC', 'pcc', []),
                        LocationStructure('PCP', 'pcp', []),
                        LocationStructure('PDR', 'pdr', []),
                        LocationStructure('PLC', 'plc', []),
                    ])
                ]),
                LocationStructure('DRTB', 'drtb', []),
                LocationStructure('CDST', 'cdst', []),
            ])
        ])
    ]

    location_metadata = {'is_test': 'no', 'nikshay_code': 'nikshay_code'}
    return (setup_location_types_with_structure(domain_name,
                                                location_type_structure),
            setup_locations_with_structure(domain_name, location_structure,
                                           location_metadata))
Exemple #5
0
    def _setup_enikshay_locations(self, domain_name):
        location_type_structure = [
            LocationTypeStructure('ctd', [
                LocationTypeStructure('sto', [
                    LocationTypeStructure('cto', [
                        LocationTypeStructure('dto', [
                            LocationTypeStructure('tu', [
                                LocationTypeStructure('phi', []),
                                LocationTypeStructure('dmc', []),
                            ]),
                            LocationTypeStructure('drtb-hiv', []),
                        ])
                    ]),
                    LocationTypeStructure('drtb', []),
                    LocationTypeStructure('cdst', []),
                ])
            ])
        ]
        location_structure = [
            LocationStructure('CTD', 'ctd', [
                LocationStructure('STO', 'sto', [
                    LocationStructure('CTO', 'cto', [
                        LocationStructure('DTO', 'dto', [
                            LocationStructure('TU', 'tu', [
                                LocationStructure('PHI', 'phi', []),
                                LocationStructure('DMC', 'dmc', []),
                            ]),
                            LocationStructure('DRTB-HIV', 'drtb-hiv', []),
                        ])
                    ]),
                    LocationStructure('DRTB', 'drtb', []),
                    LocationStructure('CDST', 'cdst', []),
                ])
            ])
        ]

        setup_location_types_with_structure(domain_name, location_type_structure)
        return setup_locations_with_structure(domain_name, location_structure)
    def setUpClass(cls):
        super(TestAWWVHNDSurveyIndicator, cls).setUpClass()
        cls.domain_obj = create_domain(cls.domain)

        location_type_structure = [
            LocationTypeStructure('supervisor', [
                LocationTypeStructure('awc', [])
            ])
        ]
        location_structure = [
            LocationStructure('LSL', 'supervisor', [
                LocationStructure('AWC1', 'awc', []),
            ])
        ]
        cls.loc_types = setup_location_types_with_structure(cls.domain, location_type_structure)
        cls.locs = setup_locations_with_structure(cls.domain, location_structure)
        cls.ls = cls._make_user('ls', cls.locs['LSL'])
        cls.aww = cls._make_user('aww', cls.locs['AWC1'])
    def setUpClass(cls):
        super(TestLSVHNDSurveyIndicator, cls).setUpClass()
        cls.domain_obj = create_domain(cls.domain)

        location_type_structure = [
            LocationTypeStructure('supervisor', [
                LocationTypeStructure('awc', [])
            ])
        ]
        location_structure = [
            LocationStructure('LSL', 'supervisor', [
                LocationStructure('AWC1', 'awc', []),
                LocationStructure('AWC2', 'awc', []),
            ])
        ]
        cls.loc_types = setup_location_types_with_structure(cls.domain, location_type_structure)
        cls.locs = setup_locations_with_structure(cls.domain, location_structure)
        cls.ls = cls._make_user('ls', cls.locs['LSL'])
        cls.aww = cls._make_user('aww', cls.locs['AWC1'])
Exemple #8
0
    def setUpClass(cls):
        super(BaseAggregatePerformanceTestCase, cls).setUpClass()
        cls.domain_obj = create_domain(cls.domain)

        location_type_structure = [
            LocationTypeStructure('supervisor', [
                LocationTypeStructure('awc', [])
            ])
        ]
        location_structure = [
            LocationStructure('LSL', 'supervisor', [
                LocationStructure('AWC1', 'awc', []),
                LocationStructure('AWC2', 'awc', []),
                LocationStructure('AWC3', 'awc', []),
            ])
        ]
        cls.loc_types = setup_location_types_with_structure(cls.domain, location_type_structure)
        cls.locs = setup_locations_with_structure(cls.domain, location_structure)
        cls.ls = cls._make_user('ls', cls.locs['LSL'])
        cls.aww = cls._make_user('aww', cls.locs['AWC1'])
    def setUpClass(cls):
        super(CustomCriteriaTestCase, cls).setUpClass()

        cls.domain_obj = create_domain(cls.domain)

        location_type_structure = [
            LocationTypeStructure(
                SUPERVISOR_LOCATION_TYPE_CODE,
                [LocationTypeStructure(AWC_LOCATION_TYPE_CODE, [])])
        ]

        location_structure = [
            LocationStructure('LS1', SUPERVISOR_LOCATION_TYPE_CODE, [
                LocationStructure('AWC1', AWC_LOCATION_TYPE_CODE, []),
            ])
        ]

        cls.loc_types = setup_location_types_with_structure(
            cls.domain, location_type_structure)
        cls.locs = setup_locations_with_structure(cls.domain,
                                                  location_structure)

        cls.ls = cls._make_user('ls', cls.locs['LS1'])
        cls.aww = cls._make_user('aww', cls.locs['AWC1'])