• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python scripted.TestScript类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中rapidsms.tests.scripted.TestScript的典型用法代码示例。如果您正苦于以下问题:Python TestScript类的具体用法?Python TestScript怎么用?Python TestScript使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TestScript类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setUp

    def setUp(self):
        self._clear_data()
        
        TestScript.setUp(self, default_lang='sw')
        self.domain = Domain.objects.get_or_create(name='mockdomain')[0]
        chws = ReporterGroup(title="mocksupes")
        chws.save()
        chvs = ReporterGroup(title="mocksubs")
        chvs.save()
        org = Organization(name="mockorg", domain=self.domain)
        org.members = chvs
        org.supervisors = chws
        org.save()
        
        backend = PersistantBackend.objects.get_or_create(slug=self.backend.slug)[0]
        self.sub, self.sub_profile = create_active_reporter_and_profile(backend, self.domain, phone_number="306", username='lucy')
        self.supe, self.supe_profile = create_active_reporter_and_profile(backend, self.domain, phone_number="3093", username='supe')
        
        self.sub.groups.add(chvs)
        self.supe.groups.add(chws)

        path = os.path.dirname(__file__)
        self.formdefmodel = create_xsd_and_populate("data/brac_chp.xsd", 
                                                    domain=self.domain, 
                                                    path=path)
        self.submit = populate("data/brac_chp_1.xml", domain=self.domain,
                               path=path)
        self.submit.submit_time = datetime.now() - timedelta(days=3)
        self.submit.save()
        
        self.router.start()
开发者ID:commtrack,项目名称:temp-aquatest,代码行数:31,代码来源:brac.py


示例2: setUp

    def setUp(self):
        TestScript.setUp(self)
            
        # make some nodes and graphs
        # imagine this is users and groups for clarity
        self.m_nodes = [_contact(n) for n in self.m_names]
        self.w_nodes = [_contact(n) for n in self.w_names]
        self.girl_nodes = [_contact(n) for n in self.girl_names]
        self.boy_nodes = [_contact(n) for n in self.boy_names]
        self.m_group = _group('men',*self.m_nodes)
        self.w_group = _group('women',*self.w_nodes)
        self.g_group = _group('girls',*self.girl_nodes)
        self.g_group.add_to_parent(self.w_group)
        self.b_group = _group('boys',*self.boy_nodes)
        self.b_group.add_to_parent(self.m_group)

        self.people_group = _group('people', self.m_group, self.w_group)

        self.all_groups = [
                        self.people_group,
                        self.b_group,
                        self.g_group,
                        self.m_group,
                        self.w_group
                        ]
        
        self.router=MockRouter()
        self.backend=MockBackend(self.router)
        self.uid0='4156661212'
        self.uid1='6175551212'
        self.uid2='6195551212'
开发者ID:ewheeler,项目名称:rapidsms-community-apps,代码行数:31,代码来源:tests.py


示例3: setUp

 def setUp(self):
     TestScript.setUp(self)
     location = Location.objects.get(code='de')
     facilitytype = SupplyPointType.objects.get(code='hc')
     rms = SupplyPoint.objects.get(code='garms')
     SupplyPoint.objects.get_or_create(code='dedh', name='Dangme East District Hospital',
                                    location=location, active=True,
                                    type=facilitytype, supplied_by=rms)
开发者ID:andile2012,项目名称:logistics,代码行数:8,代码来源:registration.py


示例4: tearDown

 def tearDown(self):
     Location.objects.all().delete()
     SupplyPoint.objects.all().delete()
     Product.objects.all().delete()
     ProductStock.objects.all().delete()
     StockTransaction.objects.all().delete()
     ProductReport.objects.all().delete()
     TestScript.tearDown(self)
开发者ID:agrzywinski,项目名称:rapidsms-logistics,代码行数:8,代码来源:consumption.py


示例5: setUp

 def setUp(self):
     TestScript.setUp(self)
     survey = Survey.objects.create(location='test', begin_date=date.today()-timedelta(7), end_date=date.today()+timedelta(7))
     # this is the birthdate used in the tests
     birthdate = date(2008,2,10)
     td = date.today() - birthdate
     # calculate how many months ago so we know what to expect in the
     # confirmation message, since we cannot hard-code the expected reply
     self.months_ago = str(int(td.days/30.4375))
开发者ID:ewheeler,项目名称:rapidsms-growthmonitoring-app,代码行数:9,代码来源:tests.py


示例6: setUp

 def setUp (self):
     # since the database is not nuked, there's no point in reloading these every time
     # this also messes up 13 and 14 which change the db
     # plus the unit tests are waaaay faster
     global loaded
     if not loaded:
         # borrowed from django/test/testcases.py
         call_command('loaddata', *self.fixtures, **{'verbosity': 0})            
         loaded = True
     TestScript.setUp(self)
开发者ID:mberg,项目名称:mctc,代码行数:10,代码来源:tests.py


示例7: setUp

 def setUp(self):
     settings.LOGISTICS_STOCKED_BY = 'user'
     TestScript.setUp(self)
     load_test_data()
     self.facility = SupplyPoint.objects.get(code='dedh')
     prod_type = ProductType.objects.all()[0]
     self.commodity, created = Product.objects.get_or_create(
       sms_code='ab', name='Drug A', type=prod_type, units='cycle')
     self.commodity2, created = Product.objects.get_or_create(
       sms_code='cd', name='Drug B', type=prod_type, units='cycle')
     self.contact = register_user(self, '8282', 'tester', self.facility.code, self.facility.name)
开发者ID:andile2012,项目名称:logistics,代码行数:11,代码来源:reminders.py


示例8: setUp

    def setUp(self):
        TestScript.setUp(self)

        load_test_data()
        
        settings.LOGISTICS_CONSUMPTION["MINIMUM_DAYS"] = 10
        settings.LOGISTICS_CONSUMPTION["MINIMUM_TRANSACTIONS"] = 2
        settings.LOGISTICS_CONSUMPTION["LOOKBACK_DAYS"] = None
        settings.LOGISTICS_CONSUMPTION["INCLUDE_END_STOCKOUTS"] = False
        
        self.pr = Product.objects.all()[0]
        self.sp = Facility.objects.all()[0]
        self.ps = ProductStock.objects.get(supply_point=self.sp, product=self.pr)
        self.ps.use_auto_consumption = True
        self.ps.save()
开发者ID:agrzywinski,项目名称:rapidsms-logistics,代码行数:15,代码来源:consumption.py


示例9: setUp

    def setUp(self):
        settings.LOGISTICS_STOCKED_BY = 'user'
        TestScript.setUp(self)
        location = Location.objects.get(code='de')
        facilitytype = SupplyPointType.objects.get(code='hc')
        self.rms = SupplyPoint.objects.get(code='garms')
        facility, created = SupplyPoint.objects.get_or_create(code='dedh',
                                                           name='Dangme East District Hospital',
                                                           location=location, active=True,
                                                           type=facilitytype, supplied_by=self.rms)
        assert facility.supplied_by == self.rms
        mc = Product.objects.get(sms_code='mc')
        self.lf = Product.objects.get(sms_code='lf')
        ProductStock(product=mc, supply_point=facility,
                     monthly_consumption=8).save()
        ProductStock(product=self.lf, supply_point=facility,
                     monthly_consumption=5).save()
        facility = SupplyPoint(code='tf', name='Test Facility',
                       location=location, active=True,
                       type=facilitytype, supplied_by=self.rms)
        facility.save()
        mc = Product.objects.get(sms_code='mc')
        mg = Product.objects.get(sms_code='mg')
        self.mc_stock = ProductStock(is_active=True, supply_point=facility,
                                    product=mc, monthly_consumption=10)
        self.mc_stock.save()
        self.lf_stock = ProductStock(is_active=True, supply_point=facility,
                                    product=self.lf, monthly_consumption=10)
        self.lf_stock.save()
        self.mg_stock = ProductStock(is_active=False, supply_point=facility,
                                     product=mg, monthly_consumption=10)
        self.mg_stock.save()

        ng = Product.objects.get(sms_code='ng')
        self.ng_stock = ProductStock(is_active=True, supply_point=facility,
                                    product=ng, monthly_consumption=None)
        self.ng_stock.save()
        
        self.contact = Contact(name='test user')
        self.contact.save()
        self.connection = Connection(backend=Backend.objects.all()[0],
                                     identity="888",
                                     contact=self.contact)
        self.connection.save()
        self.contact.supply_point = facility
        self.contact.save()
        self.contact.commodities.add(ng)
开发者ID:andile2012,项目名称:logistics,代码行数:47,代码来源:stockonhand.py


示例10: setUp

    def setUp(self):
        TestScript.setUp(self)
            
        # make some nodes and graphs
        # imagine this is users and groups for clarity
        self.m_nodes = [user(n) for n in self.m_names]
        self.w_nodes = [user(n) for n in self.w_names]
        self.girl_nodes = [user(n) for n in self.girl_names]
        self.boy_nodes = [user(n) for n in self.boy_names]
        self.m_group = group('men',*self.m_nodes)
        self.w_group = group('women',*self.w_nodes)
        self.g_group = group('girls',*self.girl_nodes)
        self.g_group.add_to_parent(self.w_group)
        self.b_group = group('boys',*self.boy_nodes)
        self.b_group.add_to_parent(self.m_group)

        self.people_group = group('people', self.m_group, self.w_group)

        # set up Cyclic(A(B(*A,woman),man))
        self.cyc_a=group('a',self.m_nodes[0])
        self.cyc_b=group('b',self.cyc_a,self.w_nodes[0])
        self.cyc_a.add_children(self.cyc_b)
        self.cyclic_group=group('cyclic',self.cyc_a)
               
        # simple tree 
        self.leaf1=user('leaf1')
        self.leaf2=user('leaf2')
        self.simple_tree=group('tree', group('L1',group('L2',self.leaf1, group('L3',self.leaf2))))
        
        self.all_groups = [
                        self.simple_tree,
                        self.cyclic_group,
                        self.cyc_a,
                        self.cyc_b,
                        self.people_group,
                        self.b_group,
                        self.g_group,
                        self.m_group,
                        self.w_group
                        ]
开发者ID:GunioRobot,项目名称:rapidsms-tostan,代码行数:40,代码来源:basic.py


示例11: setUp

    def setUp(self):
        TestScript.setUp(self)

        # make some nodes and graphs
        # imagine this is users and groups for clarity
        self.m_nodes = [_user(n) for n in self.m_names]
        self.w_nodes = [_user(n) for n in self.w_names]
        self.girl_nodes = [_user(n) for n in self.girl_names]
        self.boy_nodes = [_user(n) for n in self.boy_names]
        self.m_group = _group("men", *self.m_nodes)
        self.w_group = _group("women", *self.w_nodes)
        self.g_group = _group("girls", *self.girl_nodes)
        self.g_group.add_to_parent(self.w_group)
        self.b_group = _group("boys", *self.boy_nodes)
        self.b_group.add_to_parent(self.m_group)

        self.people_group = _group("people", self.m_group, self.w_group)

        # set up Cyclic(A(B(*A,woman),man))
        self.cyc_a = _group("a", self.m_nodes[0])
        self.cyc_b = _group("b", self.cyc_a, self.w_nodes[0])
        self.cyc_a.add_children(self.cyc_b)
        self.cyclic_group = _group("cyclic", self.cyc_a)

        # simple tree
        self.leaf1 = _user("leaf1")
        self.leaf2 = _user("leaf2")
        self.simple_tree = _group("tree", _group("L1", _group("L2", self.leaf1, _group("L3", self.leaf2))))

        self.all_groups = [
            self.simple_tree,
            self.cyclic_group,
            self.cyc_a,
            self.cyc_b,
            self.people_group,
            self.b_group,
            self.g_group,
            self.m_group,
            self.w_group,
        ]
开发者ID:jwishnie,项目名称:rapidsms-tostan,代码行数:40,代码来源:tests.py


示例12: setUp

 def setUp(self):
     TestScript.setUp(self)
     location = Location.objects.get(code='de')
     facilitytype = SupplyPointType.objects.get(code='hc')
     facility, created = SupplyPoint.objects.get_or_create(code='dedh',
                                     name='Dangme East District Hospital',
                                     location=location, active=True,
                                     type=facilitytype, supplied_by=None)
     mc = Product.objects.get(sms_code='mc')
     lf = Product.objects.get(sms_code='lf')
     mg = Product.objects.get(sms_code='mg')
     ng = Product.objects.get(sms_code='ng')
     ProductStock(is_active=True, product=mc, supply_point=facility,
                  monthly_consumption=5).save()
     ProductStock(is_active=True, product=lf, supply_point=facility,
                  monthly_consumption=5).save()
     ProductStock(is_active=True, product=mg, supply_point=facility,
                  monthly_consumption=5).save()
     ProductStock(is_active=False, product=ng, supply_point=facility,
                  monthly_consumption=5).save()
     contact = register_user(self, "888", "testuser", "dedh")
     contact.commodities.add(mc)
     contact.commodities.add(lf)
开发者ID:andile2012,项目名称:logistics,代码行数:23,代码来源:stockedby.py


示例13: setUp

 def setUp(self):
     TestScript.setUp(self)
     load_test_data()
     self.facility = SupplyPoint.objects.get(code='dedh')
     settings.LOGISTICS_STOCKED_BY = 'user'
开发者ID:andile2012,项目名称:logistics,代码行数:5,代码来源:validator.py


示例14: setUp

 def setUp(self):
     global callback_counter
     callback_counter = 0
     TestScript.setUp(self)
     EventSchedule.objects.all().delete()
开发者ID:thoughtworks,项目名称:rapidsms,代码行数:5,代码来源:speedup.py


示例15: setUp

 def setUp(self):
     TestScript.setUp(self)
     DeliveryGroup.objects.all().delete()
开发者ID:andile2012,项目名称:logistics,代码行数:3,代码来源:deliverygroup.py


示例16: setUp

 def setUp(self):
     TestScript.setUp(self)
开发者ID:GunioRobot,项目名称:rapidsms-tostan,代码行数:2,代码来源:tests.py


示例17: setUp

 def setUp(self):
     TestScript.setUp(self)
     load_test_data()
开发者ID:andile2012,项目名称:logistics,代码行数:3,代码来源:requisition_status.py


示例18: tearDown

 def tearDown(self):
     ProductStock.objects.all().delete()
     TestScript.tearDown(self)
开发者ID:andile2012,项目名称:logistics,代码行数:3,代码来源:stockedby.py


示例19: setUp

 def setUp(self):
     TestScript.setUp(self)
     ville = Village(name='nonexistant1')
     ville.save()
     ville = Village(name='nonexistant2')
     ville.save()
开发者ID:aliounedia,项目名称:rapidsms-tostan,代码行数:6,代码来源:suggestions.py


示例20: tearDown

 def tearDown(self):
     TestScript.tearDown(self)
     self.mc_stock.delete()
     self.mg_stock.delete()
     self.lf_stock.delete()
开发者ID:andile2012,项目名称:logistics,代码行数:5,代码来源:stockonhand.py



注:本文中的rapidsms.tests.scripted.TestScript类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.paginated函数代码示例发布时间:2022-05-26
下一篇:
Python rapidjson.loads函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap