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

Python test_base.MainTestCase类代码示例

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

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



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

示例1: setUp

 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form_and_submit_instance()
     self.public_api_url = reverse(
         public_api, kwargs={"username": self.user.username, "id_string": self.xform.id_string}
     )
开发者ID:GeoODK,项目名称:formhub,代码行数:7,代码来源:test_form_public_api.py


示例2: setUp

 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
     s = 'transport_2011-07-25_19-05-49'
     self._make_submission(os.path.join(self.this_directory, 'fixtures',
         'transportation', 'instances', s, s + '.xml'))
     self.submission = self.xform.surveys.reverse()[0]
     self.url = reverse(map_view, kwargs={'username': self.user.username,
         'id_string': self.xform.id_string})
     self.perm_url = reverse(set_perm, kwargs={
         'username': self.user.username, 'id_string': self.xform.id_string})
     self.edit_url = reverse(edit, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string
     })
     self.show_url = reverse(show,
                 kwargs={'uuid': self.xform.uuid})
     self.show_normal_url = reverse(show, kwargs={
             'username': self.user.username,
             'id_string': self.xform.id_string
     })
     self.api_url = reverse(api, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string
     })
开发者ID:larryweya,项目名称:formhub,代码行数:26,代码来源:test_form_permissions.py


示例3: setUp

 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form_and_submit_instance()
     self.url = reverse(show, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string
     })
开发者ID:TomCoder,项目名称:formhub,代码行数:8,代码来源:test_form_show.py


示例4: setUp

 def setUp(self):
     MainTestCase.setUp(self)
     self.set_role_url = reverse(set_role)
     self._create_user_and_login()
     self._publish_transportation_form()
     self.form_show_url = reverse(show, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string
     })
     UserProfile.objects.get_or_create(user=self.user)
开发者ID:GOMOGI,项目名称:formhub,代码行数:10,代码来源:test_people_roles.py


示例5: setUp

 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form_and_submit_instance()
     self.submission = self.xform.surveys.reverse()[0]
     self.url = reverse(show_submission, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string,
         'uuid': self.submission.uuid,
     })
     self.survey_url = reverse(survey_responses, kwargs={
             'instance_id': self.submission.pk })
开发者ID:Ecotrust,项目名称:formhub,代码行数:12,代码来源:test_form_show_submission.py


示例6: setUp

 def setUp(self):
     MainTestCase.setUp(self)
     #Already done by setUp
     #self._create_user_and_login()
     self._publish_transportation_form_and_submit_instance()
     self.perm_url = reverse(set_perm, kwargs={
         'username': self.user.username, 'id_string': self.xform.id_string})
     self.show_url = reverse(show, kwargs={'uuid': self.xform.uuid})
     self.url = reverse(enter_data, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string
     })
开发者ID:GOMOGI,项目名称:formhub,代码行数:12,代码来源:test_form_enter_data.py


示例7: setUp

 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form_and_submit_instance()
     self.delete_url = reverse(delete_data, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string
     })
     self.mongo_args = {
         'username': self.user.username, 'id_string': self.xform.id_string,
         'query': "{}", 'limit': 1,
         'sort': '{"_id":-1}', 'fields': '["_id","_uuid"]'}
开发者ID:muazmohamed,项目名称:formhub,代码行数:12,代码来源:test_form_api_delete.py


示例8: setUp

    def setUp(self):
        MainTestCase.setUp(self)
        self._create_user_and_login()
        self._publish_transportation_form()

        # turn on crowd forms for this form
        self.xform.is_crowd_form = True
        self.xform.save()
        self.edit_url = reverse(edit, kwargs={
            'username': self.xform.user.username,
            'id_string': self.xform.id_string
        })
        self.alice = 'alice'
        self.crowdform_count = 0
开发者ID:KeithDoyle,项目名称:formhub,代码行数:14,代码来源:test_crowdforms.py


示例9: setUp

 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
     s = "transport_2011-07-25_19-05-49"
     self._make_submission(
         os.path.join(self.this_directory, "fixtures", "transportation", "instances", s, s + ".xml")
     )
     self.submission = self.xform.surveys.reverse()[0]
     self.url = reverse(map_view, kwargs={"username": self.user.username, "id_string": self.xform.id_string})
     self.perm_url = reverse(set_perm, kwargs={"username": self.user.username, "id_string": self.xform.id_string})
     self.edit_url = reverse(edit, kwargs={"username": self.user.username, "id_string": self.xform.id_string})
     self.show_url = reverse(show, kwargs={"uuid": self.xform.uuid})
     self.show_normal_url = reverse(show, kwargs={"username": self.user.username, "id_string": self.xform.id_string})
     self.api_url = reverse(api, kwargs={"username": self.user.username, "id_string": self.xform.id_string})
开发者ID:GeoODK,项目名称:formhub,代码行数:15,代码来源:test_form_permissions.py


示例10: _publish_transportation_id_string_starts_with_number_form

 def _publish_transportation_id_string_starts_with_number_form(self):
     xls_path = os.path.join(
         self.this_directory, "fixtures", "transportation", "transportation.id_starts_with_num.xls"
     )
     count = XForm.objects.count()
     response = MainTestCase._publish_xls_file(self, xls_path)
     self.assertEqual(XForm.objects.count(), count + 1)
     self.xform = XForm.objects.all().reverse()[0]
开发者ID:GeoODK,项目名称:formhub,代码行数:8,代码来源:test_form_gallery.py


示例11: _publish_xls_file

    def _publish_xls_file(self):
        xls_path = os.path.join(self.this_directory, "fixtures", "transportation", "transportation.xls")
        pre_count = XForm.objects.count()
        response = MainTestCase._publish_xls_file(self, xls_path)

        # make sure publishing the survey worked
        self.assertEqual(response.status_code, 200)
        self.assertEqual(XForm.objects.count(), pre_count+1)
        self.xform = list(XForm.objects.all())[-1]
        self.assertEqual(self.xform.id_string, "transportation_2011_07_25")
开发者ID:Topol,项目名称:formhub,代码行数:10,代码来源:test_process.py


示例12: test_publish_bad_xls_with_unicode_in_error

 def test_publish_bad_xls_with_unicode_in_error(self):
     """
     Check that publishing a bad xls where the error has a unicode character
     returns a 200, thus showing a readable error to the user
     """
     self._create_user_and_login()
     path = os.path.join(self.this_directory, "fixtures", "form_with_unicode_in_relevant_column.xlsx")
     response = MainTestCase._publish_xls_file(self, path)
     # make sure we get a 200 response
     self.assertEqual(response.status_code, 200)
开发者ID:ribalba,项目名称:formhub,代码行数:10,代码来源:test_process.py


示例13: test_uuid_injection_in_cascading_select

    def test_uuid_injection_in_cascading_select(self):
        """Test that the uuid is injected in the right instance node for
        forms with a cascading select"""
        pre_count = XForm.objects.count()
        xls_path = os.path.join(self.this_directory, "fixtures", "cascading_selects", "new_cascading_select.xls")
        file_name, file_ext = os.path.splitext(os.path.split(xls_path)[1])
        self.response = MainTestCase._publish_xls_file(self, xls_path)
        post_count = XForm.objects.count()
        self.assertEqual(post_count, pre_count + 1)
        xform = XForm.objects.latest("date_created")

        # check that the uuid is within the main instance/ the one without an id attribute
        xml = clean_and_parse_xml(xform.xml)

        # check for instance nodes that are direct children of the model node
        model_node = xml.getElementsByTagName("model")[0]
        instance_nodes = [
            node
            for node in model_node.childNodes
            if node.nodeType == Node.ELEMENT_NODE and node.tagName.lower() == "instance" and not node.hasAttribute("id")
        ]
        self.assertEqual(len(instance_nodes), 1)
        instance_node = instance_nodes[0]

        # get the first element whose id attribute is equal to our form's id_string
        form_nodes = [
            node
            for node in instance_node.childNodes
            if node.nodeType == Node.ELEMENT_NODE and node.getAttribute("id") == xform.id_string
        ]
        form_node = form_nodes[0]

        # find the formhub node that has a uuid child node
        formhub_nodes = form_node.getElementsByTagName("formhub")
        self.assertEqual(len(formhub_nodes), 1)
        uuid_nodes = formhub_nodes[0].getElementsByTagName("uuid")
        self.assertEqual(len(uuid_nodes), 1)

        # check for the calculate bind
        calculate_bind_nodes = [
            node
            for node in model_node.childNodes
            if node.nodeType == Node.ELEMENT_NODE
            and node.tagName == "bind"
            and node.getAttribute("nodeset") == "/%s/formhub/uuid" % file_name
        ]
        self.assertEqual(len(calculate_bind_nodes), 1)
        calculate_bind_node = calculate_bind_nodes[0]
        self.assertEqual(calculate_bind_node.getAttribute("calculate"), "'%s'" % xform.uuid)
开发者ID:ribalba,项目名称:formhub,代码行数:49,代码来源:test_process.py


示例14: _publish_file

 def _publish_file(self, xls_path, strict=True):
     """
     Returns False if not strict and publish fails
     """
     pre_count = XForm.objects.count()
     self.response = MainTestCase._publish_xls_file(self, xls_path)
     # make sure publishing the survey worked
     self.assertEqual(self.response.status_code, 200)
     if XForm.objects.count() != pre_count + 1:
         # print file location
         print '\nPublish Failure for file: %s' % xls_path
         if strict:
             self.assertEqual(XForm.objects.count(), pre_count + 1)
         else:
             return False
     self.xform = list(XForm.objects.all().order_by('date_created'))[-1]
     return True
开发者ID:GOMOGI,项目名称:formhub,代码行数:17,代码来源:test_process.py


示例15: setUp

 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
     self.url = reverse(clone_xlsform, kwargs={"username": self.user.username})
开发者ID:GeoODK,项目名称:formhub,代码行数:5,代码来源:test_form_gallery.py


示例16: setUp

 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login('bob', 'bob')
     self._publish_transportation_form()
     self.url = reverse(formList, kwargs={'username': self.user.username})
开发者ID:KeithDoyle,项目名称:formhub,代码行数:5,代码来源:test_form_auth.py


示例17: setUp

 def setUp(self):
     MainTestCase.setUp(self)
     self.settings_url = reverse(
         profile_settings, kwargs={'username': self.user.username})
开发者ID:ACTillage,项目名称:formhub,代码行数:4,代码来源:test_user_settings.py


示例18: _publish_survey

 def _publish_survey(self):
     self.this_directory = os.path.dirname(__file__)
     xls_path = os.path.join(
         self.this_directory, "fixtures", "gps", "gps.xls")
     MainTestCase._publish_xls_file(self, xls_path)
开发者ID:Ecotrust,项目名称:formhub,代码行数:5,代码来源:test_kml_export.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python test_base.TestBase类代码示例发布时间:2022-05-27
下一篇:
Python test_base.print_command函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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