Exemplo n.º 1
0
    def test_stop(self):
        bootstrap_user(self.loc1, username='******', domain=self.domain.name, phone_number='643',
                       first_name='stop', last_name='Person')

        script = """
          643 > stop
          643 < {0}
        """.format(unicode(STOP_CONFIRM))
        self.run_script(script)
        contact = CommCareUser.get_by_username('stop_person')
        self.assertFalse(contact.is_active)
Exemplo n.º 2
0
    def test_stop(self):
        bootstrap_user(self.loc1, username='******', domain=self.domain.name, phone_number='643',
                       first_name='stop', last_name='Person', language='sw')

        with localize('sw'):
            response = unicode(STOP_CONFIRM)

        script = """
          643 > stop
          643 < {0}
        """.format(response)
        self.run_script(script)
        contact = CommCareUser.get_by_username('stop_person')
        self.assertFalse(contact.is_active)
Exemplo n.º 3
0
    def setUpClass(cls):
        domain = prepare_domain(TEST_DOMAIN)
        mohsw = make_loc(code="moh1", name="Test MOHSW 1", type="MOHSW", domain=domain.name)

        msdzone = make_loc(code="msd1", name="MSD Zone 1", type="MSDZONE",
                          domain=domain.name, parent=mohsw)

        region = make_loc(code="reg1", name="Test Region 1", type="REGION",
                          domain=domain.name, parent=msdzone)

        district = make_loc(code="dis1", name="Test District 1", type="DISTRICT",
                            domain=domain.name, parent=region)
        facility = make_loc(code="loc1", name="Test Facility 1", type="FACILITY",
                            domain=domain.name, parent=district)
        facility2 = make_loc(code="loc2", name="Test Facility 2", type="FACILITY",
                             domain=domain.name, parent=district)
        test.bootstrap(TEST_BACKEND, to_console=True)
        bootstrap_user(facility, username='******', domain=domain.name, home_loc='loc1', phone_number='5551234',
                       first_name='stella', last_name='Test')
        bootstrap_user(facility2, username='******', domain=domain.name, home_loc='loc2', phone_number='5555678',
                       first_name='bella', last_name='Test')
        bootstrap_user(district, username='******', domain=domain.name, home_loc='dis1', phone_number='555',
                       first_name='trella', last_name='Test')
        bootstrap_user(district, username='******', domain=domain.name, phone_number='111',
                       first_name='MSD', last_name='Person', user_data={'role': 'MSD'})

        p = Product(domain=domain.name, name='Jadelle', code='jd', unit='each')
        p.save()
        p2 = Product(domain=domain.name, name='Mc', code='mc', unit='each')
        p2.save()
Exemplo n.º 4
0
    def setUpClass(cls):
        super(TestStockOut, cls).setUpClass()
        cls.facility2 = make_loc(code="loc2", name="Test Facility 2", type="FACILITY",
                                 domain=TEST_DOMAIN, parent=cls.district)
        cls.user2 = bootstrap_user(
            cls.facility2, username='******', domain=TEST_DOMAIN, home_loc='loc2', phone_number='5551235',
            first_name='test', last_name='Test'
        )
        SLABConfig.objects.create(
            is_pilot=True,
            sql_location=cls.facility.sql_location
        )

        slab_config = SLABConfig.objects.create(
            is_pilot=True,
            sql_location=cls.facility2.sql_location
        )
        slab_config.closest_supply_points.add(cls.facility.sql_location)
        slab_config.save()

        config = CommtrackConfig.for_domain(TEST_DOMAIN)
        config.use_auto_consumption = False
        config.individual_consumption_defaults = True
        config.consumption_config = ConsumptionConfig(
            use_supply_point_type_default_consumption=True,
            exclude_invalid_periods=True
        )
        config.save()

        set_default_consumption_for_supply_point(TEST_DOMAIN, cls.id.get_id, cls.facility_sp_id, 100)
        set_default_consumption_for_supply_point(TEST_DOMAIN, cls.dp.get_id, cls.facility_sp_id, 100)
        set_default_consumption_for_supply_point(TEST_DOMAIN, cls.ip.get_id, cls.facility_sp_id, 100)
Exemplo n.º 5
0
    def setUpClass(cls):
        super(RemindersTest, cls).bypass_setUpClass()
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend(
        )
        cls.domain = prepare_domain(TEST_DOMAIN)

        cls.district = make_loc(code="dis1",
                                name="Test District 1",
                                type="DISTRICT",
                                domain=TEST_DOMAIN)
        cls.facility = make_loc(code="loc1",
                                name="Test Facility 1",
                                type="FACILITY",
                                domain=TEST_DOMAIN,
                                parent=cls.district)
        cls.facility_sp_id = cls.facility.sql_location.supply_point_id
        cls.user1 = bootstrap_user(cls.facility,
                                   username='******',
                                   domain=TEST_DOMAIN,
                                   home_loc='loc1',
                                   phone_number='5551234',
                                   first_name='test',
                                   last_name='Test')
        create_products(cls, TEST_DOMAIN, [
            "id", "dp", "fs", "md", "ff", "dx", "bp", "pc", "qi", "jd", "mc",
            "ip"
        ])
Exemplo n.º 6
0
    def setUpClass(cls):
        super(TestStockOut, cls).setUpClass()
        cls.facility2 = make_loc(code="loc2", name="Test Facility 2", type="FACILITY",
                                 domain=TEST_DOMAIN, parent=cls.district)
        cls.user2 = bootstrap_user(
            cls.facility2, username='******', domain=TEST_DOMAIN, home_loc='loc2', phone_number='5551235',
            first_name='test', last_name='Test'
        )
        SLABConfig.objects.create(
            is_pilot=True,
            sql_location=cls.facility.sql_location
        )

        slab_config = SLABConfig.objects.create(
            is_pilot=True,
            sql_location=cls.facility2.sql_location
        )
        slab_config.closest_supply_points.add(cls.facility.sql_location)
        slab_config.save()

        config = CommtrackConfig.for_domain(TEST_DOMAIN)
        config.use_auto_consumption = False
        config.individual_consumption_defaults = True
        config.consumption_config = ConsumptionConfig(
            use_supply_point_type_default_consumption=True,
            exclude_invalid_periods=True
        )
        config.save()

        set_default_consumption_for_supply_point(TEST_DOMAIN, cls.id.get_id, cls.facility_sp_id, 100)
        set_default_consumption_for_supply_point(TEST_DOMAIN, cls.dp.get_id, cls.facility_sp_id, 100)
        set_default_consumption_for_supply_point(TEST_DOMAIN, cls.ip.get_id, cls.facility_sp_id, 100)
Exemplo n.º 7
0
    def setUpClass(cls):
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend()
        domain = prepare_domain(TEST_DOMAIN)
        mohsw = make_loc(code="moh1", name="Test MOHSW 1", type="MOHSW", domain=domain.name)

        msdzone = make_loc(code="msd1", name="MSD Zone 1", type="MSDZONE",
                           domain=domain.name, parent=mohsw)

        region = make_loc(code="reg1", name="Test Region 1", type="REGION",
                          domain=domain.name, parent=msdzone)
        cls.district = make_loc(code="dis1", name="Test District 1", type="DISTRICT",
                                domain=domain.name, parent=region)
        cls.facility = make_loc(code="loc1", name="Test Facility 1", type="FACILITY",
                                domain=domain.name, parent=cls.district)
        cls.facility.metadata['group'] = 'B'
        cls.facility2 = make_loc(code="loc2", name="Test Facility 2", type="FACILITY",
                                 domain=domain.name, parent=cls.district)
        cls.facility2.metadata['group'] = 'C'
        cls.facility.save()
        cls.facility2.save()

        cls.user1 = bootstrap_user(
            cls.facility, username='******', domain=domain.name, home_loc='loc1', phone_number='5551234',
            first_name='test', last_name='Test'
        )
        bootstrap_user(cls.facility2, username='******', domain=domain.name, home_loc='loc2',
                       phone_number='5555678', first_name='test1', last_name='Test')
        bootstrap_user(cls.district, username='******', domain=domain.name, home_loc='dis1', phone_number='555',
                       first_name='test1', last_name='Test')
        bootstrap_user(cls.district, username='******', domain=domain.name, phone_number='111',
                       first_name='MSD', last_name='Person', user_data={'role': 'MSD'})
Exemplo n.º 8
0
    def setUpClass(cls):
        super(TestReminders, cls).setUpClass()
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend()
        domain = prepare_domain(TEST_DOMAIN)
        mohsw = make_loc(code="moh1", name="Test MOHSW 1", type="MOHSW", domain=domain.name)

        msdzone = make_loc(code="msd1", name="MSD Zone 1", type="MSDZONE",
                           domain=domain.name, parent=mohsw)

        region = make_loc(code="reg1", name="Test Region 1", type="REGION",
                          domain=domain.name, parent=msdzone)
        cls.district = make_loc(code="dis1", name="Test District 1", type="DISTRICT",
                                domain=domain.name, parent=region)
        cls.facility = make_loc(code="loc1", name="Test Facility 1", type="FACILITY",
                                domain=domain.name, parent=cls.district)
        cls.facility.metadata['group'] = 'B'
        cls.facility2 = make_loc(code="loc2", name="Test Facility 2", type="FACILITY",
                                 domain=domain.name, parent=cls.district)
        cls.facility2.metadata['group'] = 'C'
        cls.facility.save()
        cls.facility2.save()

        cls.user1 = bootstrap_user(
            cls.facility, username='******', domain=domain.name, home_loc='loc1', phone_number='5551234',
            first_name='test', last_name='Test'
        )
        bootstrap_user(cls.facility2, username='******', domain=domain.name, home_loc='loc2',
                       phone_number='5555678', first_name='test1', last_name='Test')
        bootstrap_user(cls.district, username='******', domain=domain.name, home_loc='dis1', phone_number='555',
                       first_name='test1', last_name='Test')
        bootstrap_user(cls.district, username='******', domain=domain.name, phone_number='111',
                       first_name='MSD', last_name='Person', user_data={'role': 'MSD'})
Exemplo n.º 9
0
    def setUpClass(cls):
        super(TestReportSummaryBase, cls).setUpClass()
        delete_domain_phone_numbers(TEST_DOMAIN)
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend()
        cls.domain = prepare_domain(TEST_DOMAIN)

        cls.district = make_loc(code="dis1", name="TEST DISTRICT", type="DISTRICT", domain=TEST_DOMAIN,
                                metadata={'group': DeliveryGroups().current_submitting_group()})
        cls.facility = make_loc(code="d10001", name="Test Facility 1", type="FACILITY",
                                domain=TEST_DOMAIN, parent=cls.district,
                                metadata={'group': DeliveryGroups().current_submitting_group()})
        cls.facility2 = make_loc(code="d10002", name="Test Facility 2", type="FACILITY",
                                 domain=TEST_DOMAIN, parent=cls.district,
                                 metadata={'group': DeliveryGroups().current_delivering_group()})
        cls.facility3 = make_loc(code="d10003", name="Test Facility 3", type="FACILITY",
                                 domain=TEST_DOMAIN, parent=cls.district,
                                 metadata={'group': DeliveryGroups().current_submitting_group()})

        cls.facilities = [cls.facility, cls.facility2, cls.facility3]
        cls.district_user = bootstrap_user(
            cls.district, username='******', domain=TEST_DOMAIN, home_loc='dis1', phone_number='1234',
            first_name='test', last_name='Test'
        )

        cls.contact1 = bootstrap_user(
            cls.facility, username='******', domain=TEST_DOMAIN, home_loc='d10001', phone_number='1235',
            first_name='test', last_name='Test'
        )

        cls.contact2 = bootstrap_user(
            cls.facility2, username='******', domain=TEST_DOMAIN, home_loc='d10002', phone_number='1236',
            first_name='test', last_name='Test'
        )

        cls.contact3 = bootstrap_user(
            cls.facility3, username='******', domain=TEST_DOMAIN, home_loc='d10003', phone_number='1237',
            first_name='test', last_name='Test'
        )

        for facility in cls.facilities:
            facility.metadata['group'] = cls.relevant_group()
            facility.save()
        create_products(cls, TEST_DOMAIN, ["id", "dp", "fs", "md", "ff", "dx", "bp", "pc", "qi", "jd", "mc", "ip"])
Exemplo n.º 10
0
    def setUpClass(cls):
        super(TestReportSummaryBase, cls).setUpClass()
        delete_domain_phone_numbers(TEST_DOMAIN)
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend()
        cls.domain = prepare_domain(TEST_DOMAIN)

        cls.district = make_loc(code="dis1", name="TEST DISTRICT", type="DISTRICT", domain=TEST_DOMAIN,
                                metadata={'group': DeliveryGroups().current_submitting_group()})
        cls.facility = make_loc(code="d10001", name="Test Facility 1", type="FACILITY",
                                domain=TEST_DOMAIN, parent=cls.district,
                                metadata={'group': DeliveryGroups().current_submitting_group()})
        cls.facility2 = make_loc(code="d10002", name="Test Facility 2", type="FACILITY",
                                 domain=TEST_DOMAIN, parent=cls.district,
                                 metadata={'group': DeliveryGroups().current_delivering_group()})
        cls.facility3 = make_loc(code="d10003", name="Test Facility 3", type="FACILITY",
                                 domain=TEST_DOMAIN, parent=cls.district,
                                 metadata={'group': DeliveryGroups().current_submitting_group()})

        cls.facilities = [cls.facility, cls.facility2, cls.facility3]
        cls.district_user = bootstrap_user(
            cls.district, username='******', domain=TEST_DOMAIN, home_loc='dis1', phone_number='1234',
            first_name='test', last_name='Test'
        )

        cls.contact1 = bootstrap_user(
            cls.facility, username='******', domain=TEST_DOMAIN, home_loc='d10001', phone_number='1235',
            first_name='test', last_name='Test'
        )

        cls.contact2 = bootstrap_user(
            cls.facility2, username='******', domain=TEST_DOMAIN, home_loc='d10002', phone_number='1236',
            first_name='test', last_name='Test'
        )

        cls.contact3 = bootstrap_user(
            cls.facility3, username='******', domain=TEST_DOMAIN, home_loc='d10003', phone_number='1237',
            first_name='test', last_name='Test'
        )

        for facility in cls.facilities:
            facility.metadata['group'] = cls.relevant_group()
            facility.save()
        create_products(cls, TEST_DOMAIN, ["id", "dp", "fs", "md", "ff", "dx", "bp", "pc", "qi", "jd", "mc", "ip"])
Exemplo n.º 11
0
    def setUpClass(cls):
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend()
        domain = prepare_domain(TEST_DOMAIN)
        mohsw = make_loc(code="moh1", name="Test MOHSW 1", type="MOHSW", domain=domain.name)

        msdzone = make_loc(code="msd1", name="MSD Zone 1", type="MSDZONE", domain=domain.name, parent=mohsw)

        region = make_loc(code="reg1", name="Test Region 1", type="REGION", domain=domain.name, parent=msdzone)
        cls.district = make_loc(code="dis1", name="Test District 1", type="DISTRICT", domain=domain.name, parent=region)
        cls.facility = make_loc(
            code="loc1", name="Test Facility 1", type="FACILITY", domain=domain.name, parent=cls.district
        )
        cls.facility.metadata["group"] = "B"
        cls.facility2 = make_loc(
            code="loc2", name="Test Facility 2", type="FACILITY", domain=domain.name, parent=cls.district
        )
        cls.facility2.metadata["group"] = "C"
        cls.facility.save()
        cls.facility2.save()

        cls.user1 = bootstrap_user(
            cls.facility,
            username="******",
            domain=domain.name,
            home_loc="loc1",
            phone_number="5551234",
            first_name="test",
            last_name="Test",
        )
        bootstrap_user(
            cls.facility2,
            username="******",
            domain=domain.name,
            home_loc="loc2",
            phone_number="5555678",
            first_name="test1",
            last_name="Test",
        )
        bootstrap_user(
            cls.district,
            username="******",
            domain=domain.name,
            home_loc="dis1",
            phone_number="555",
            first_name="test1",
            last_name="Test",
        )
        bootstrap_user(
            cls.district,
            username="******",
            domain=domain.name,
            phone_number="111",
            first_name="MSD",
            last_name="Person",
            user_data={"role": "MSD"},
        )
Exemplo n.º 12
0
    def setUpClass(cls):
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend()
        cls.domain = prepare_domain(TEST_DOMAIN)

        cls.district = make_loc(code="dis1", name="Test District 1", type="DISTRICT",
                                domain=TEST_DOMAIN)
        cls.facility = make_loc(code="loc1", name="Test Facility 1", type="FACILITY",
                                domain=TEST_DOMAIN, parent=cls.district)
        cls.user1 = bootstrap_user(
            cls.district, username='******', domain=TEST_DOMAIN, home_loc='dis1', phone_number='5551234',
            first_name='test', last_name='Test'
        )
Exemplo n.º 13
0
    def setUpClass(cls):
        super(TestReportGroups, cls).setUpClass()
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend()
        cls.domain = prepare_domain(TEST_DOMAIN)

        cls.district = make_loc(code="dis1", name="Test District 1", type="DISTRICT",
                                domain=TEST_DOMAIN)
        cls.facility = make_loc(code="loc1", name="Test Facility 1", type="FACILITY",
                                domain=TEST_DOMAIN, parent=cls.district)
        cls.user1 = bootstrap_user(
            cls.district, username='******', domain=TEST_DOMAIN, home_loc='dis1', phone_number='5551234',
            first_name='test', last_name='Test'
        )
Exemplo n.º 14
0
    def setUpClass(cls):
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend()
        cls.domain = prepare_domain(TEST_DOMAIN)

        cls.district = make_loc(code="dis1", name="Test District 1", type="DISTRICT",
                                domain=TEST_DOMAIN)
        cls.facility = make_loc(code="loc1", name="Test Facility 1", type="FACILITY",
                                domain=TEST_DOMAIN, parent=cls.district)
        cls.facility_sp_id = cls.facility.sql_location.supply_point_id
        cls.user1 = bootstrap_user(
            cls.facility, username='******', domain=TEST_DOMAIN, home_loc='loc1', phone_number='5551234',
            first_name='test', last_name='Test'
        )
        create_products(cls, TEST_DOMAIN, ["id", "dp", "fs", "md", "ff", "dx", "bp", "pc", "qi", "jd", "mc", "ip"])
Exemplo n.º 15
0
    def setUpClass(cls):
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend()
        domain = prepare_domain(TEST_DOMAIN)
        mohsw = make_loc(code="moh1", name="Test MOHSW 1", type="MOHSW", domain=domain.name)

        msdzone = make_loc(code="msd1", name="MSD Zone 1", type="MSDZONE",
                          domain=domain.name, parent=mohsw)

        region = make_loc(code="reg1", name="Test Region 1", type="REGION",
                          domain=domain.name, parent=msdzone)

        district = make_loc(code="dis1", name="Test District 1", type="DISTRICT",
                            domain=domain.name, parent=region)
        district2 = make_loc(code="d10101", name="Test District 2", type="DISTRICT",
                             domain=domain.name, parent=region)
        facility = make_loc(code="loc1", name="Test Facility 1", type="FACILITY",
                            domain=domain.name, parent=district)
        facility2 = make_loc(code="loc2", name="Test Facility 2", type="FACILITY",
                             domain=domain.name, parent=district)
        facility3 = make_loc(
            code="d31049", name="Test Facility 3", type="FACILITY", domain=domain.name, parent=district
        )
        cls.user1 = bootstrap_user(
            facility, username='******', domain=domain.name, home_loc='loc1', phone_number='5551234',
            first_name='stella', last_name='Test'
        )
        bootstrap_user(facility2, username='******', domain=domain.name, home_loc='loc2', phone_number='5555678',
                       first_name='bella', last_name='Test')
        bootstrap_user(district, username='******', domain=domain.name, home_loc='dis1', phone_number='555',
                       first_name='trella', last_name='Test')
        bootstrap_user(district, username='******', domain=domain.name, phone_number='111',
                       first_name='MSD', last_name='Person', user_data={'role': 'MSD'})

        for x in xrange(1, 4):
            bootstrap_user(
                facility3,
                username='******'.format(x), domain=domain.name, phone_number=str(32346 + x),
                first_name='Person {}'.format(x), last_name='Person {}'. format(x), home_loc='d31049'
            )
            bootstrap_user(
                district2,
                username='******'.format(x), domain=domain.name, phone_number=str(32349 + x),
                first_name='dPerson {}'.format(x), last_name='dPerson {}'. format(x), home_loc='d10101'
            )

        create_products(cls, domain.name, ["id", "dp", "fs", "md", "ff", "dx", "bp", "pc", "qi", "jd", "mc", "ip"])
Exemplo n.º 16
0
    def setUpClass(cls):
        super(ILSTestScript, cls).setUpClass()
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend(
        )
        domain = prepare_domain(TEST_DOMAIN)
        mohsw = make_loc(code="moh1",
                         name="Test MOHSW 1",
                         type="MOHSW",
                         domain=domain.name)

        msdzone = make_loc(code="msd1",
                           name="MSD Zone 1",
                           type="MSDZONE",
                           domain=domain.name,
                           parent=mohsw)

        region = make_loc(code="reg1",
                          name="Test Region 1",
                          type="REGION",
                          domain=domain.name,
                          parent=msdzone)

        cls.district = make_loc(code="dis1",
                                name="Test District 1",
                                type="DISTRICT",
                                domain=domain.name,
                                parent=region)
        cls.district2 = make_loc(code="d10101",
                                 name="Test District 2",
                                 type="DISTRICT",
                                 domain=domain.name,
                                 parent=region)
        cls.district3 = make_loc(code="d10102",
                                 name="TESTDISTRICT",
                                 type="DISTRICT",
                                 domain=domain.name,
                                 parent=region)
        cls.facility = make_loc(code="loc1",
                                name="Test Facility 1",
                                type="FACILITY",
                                domain=domain.name,
                                parent=cls.district,
                                metadata={'group': 'A'})
        cls.facility_sp_id = cls.facility.sql_location.supply_point_id
        facility2 = make_loc(code="loc2",
                             name="Test Facility 2",
                             type="FACILITY",
                             domain=domain.name,
                             parent=cls.district,
                             metadata={'group': 'B'})
        cls.facility3 = make_loc(code="d31049",
                                 name="Test Facility 3",
                                 type="FACILITY",
                                 domain=domain.name,
                                 parent=cls.district,
                                 metadata={'group': 'C'})
        cls.user1 = bootstrap_user(cls.facility,
                                   username='******',
                                   domain=domain.name,
                                   home_loc='loc1',
                                   phone_number='5551234',
                                   first_name='stella',
                                   last_name='Test',
                                   language='sw')
        cls.en_user1 = bootstrap_user(cls.facility,
                                      username='******',
                                      domain=domain.name,
                                      home_loc='loc1',
                                      phone_number='5551235',
                                      first_name='stella',
                                      last_name='Test English',
                                      language='en')
        bootstrap_user(facility2,
                       username='******',
                       domain=domain.name,
                       home_loc='loc2',
                       phone_number='5555678',
                       first_name='bella',
                       last_name='Test',
                       language='sw')
        bootstrap_user(cls.district,
                       username='******',
                       domain=domain.name,
                       home_loc='dis1',
                       phone_number='555',
                       first_name='trella',
                       last_name='Test',
                       language='sw')
        bootstrap_user(cls.district,
                       username='******',
                       domain=domain.name,
                       phone_number='111',
                       first_name='MSD',
                       last_name='Person',
                       user_data={'role': 'MSD'},
                       language='sw')

        for x in range(1, 4):
            bootstrap_user(cls.facility3,
                           username='******'.format(x),
                           domain=domain.name,
                           phone_number=str(32346 + x),
                           first_name='Person {}'.format(x),
                           last_name='Person {}'.format(x),
                           home_loc='d31049',
                           language='sw')
            bootstrap_user(cls.district2,
                           username='******'.format(x),
                           domain=domain.name,
                           phone_number=str(32349 + x),
                           first_name='dPerson {}'.format(x),
                           last_name='dPerson {}'.format(x),
                           home_loc='d10101',
                           language='sw')

        create_products(cls, domain.name, [
            "id", "dp", "fs", "md", "ff", "dx", "bp", "pc", "qi", "jd", "mc",
            "ip"
        ])
Exemplo n.º 17
0
    def setUpClass(cls):
        domain = prepare_domain(TEST_DOMAIN)
        mohsw = make_loc(code="moh1",
                         name="Test MOHSW 1",
                         type="MOHSW",
                         domain=domain.name)

        msdzone = make_loc(code="msd1",
                           name="MSD Zone 1",
                           type="MSDZONE",
                           domain=domain.name,
                           parent=mohsw)

        region = make_loc(code="reg1",
                          name="Test Region 1",
                          type="REGION",
                          domain=domain.name,
                          parent=msdzone)

        district = make_loc(code="dis1",
                            name="Test District 1",
                            type="DISTRICT",
                            domain=domain.name,
                            parent=region)
        district2 = make_loc(code="d10101",
                             name="Test District 2",
                             type="DISTRICT",
                             domain=domain.name,
                             parent=region)
        facility = make_loc(code="loc1",
                            name="Test Facility 1",
                            type="FACILITY",
                            domain=domain.name,
                            parent=district)
        facility2 = make_loc(code="loc2",
                             name="Test Facility 2",
                             type="FACILITY",
                             domain=domain.name,
                             parent=district)
        facility3 = make_loc(code="d31049",
                             name="Test Facility 3",
                             type="FACILITY",
                             domain=domain.name,
                             parent=district)
        test.bootstrap(TEST_BACKEND, to_console=True)
        cls.user1 = bootstrap_user(facility,
                                   username='******',
                                   domain=domain.name,
                                   home_loc='loc1',
                                   phone_number='5551234',
                                   first_name='stella',
                                   last_name='Test')
        bootstrap_user(facility2,
                       username='******',
                       domain=domain.name,
                       home_loc='loc2',
                       phone_number='5555678',
                       first_name='bella',
                       last_name='Test')
        bootstrap_user(district,
                       username='******',
                       domain=domain.name,
                       home_loc='dis1',
                       phone_number='555',
                       first_name='trella',
                       last_name='Test')
        bootstrap_user(district,
                       username='******',
                       domain=domain.name,
                       phone_number='111',
                       first_name='MSD',
                       last_name='Person',
                       user_data={'role': 'MSD'})

        for x in xrange(1, 4):
            bootstrap_user(facility3,
                           username='******'.format(x),
                           domain=domain.name,
                           phone_number=str(32346 + x),
                           first_name='Person {}'.format(x),
                           last_name='Person {}'.format(x),
                           home_loc='d31049')
            bootstrap_user(district2,
                           username='******'.format(x),
                           domain=domain.name,
                           phone_number=str(32349 + x),
                           first_name='dPerson {}'.format(x),
                           last_name='dPerson {}'.format(x),
                           home_loc='d10101')

        create_products(cls, domain.name, [
            "id", "dp", "fs", "md", "ff", "dx", "bp", "pc", "qi", "jd", "mc",
            "ip"
        ])