当前位置: 首页>>代码示例>>Python>>正文


Python TestBase.setUp方法代码示例

本文整理汇总了Python中onadata.apps.main.tests.test_base.TestBase.setUp方法的典型用法代码示例。如果您正苦于以下问题:Python TestBase.setUp方法的具体用法?Python TestBase.setUp怎么用?Python TestBase.setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在onadata.apps.main.tests.test_base.TestBase的用法示例。


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

示例1: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.setUp(self)
     xls_file_path = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         "../fixtures/tutorial/tutorial.xls"
     )
     self._publish_xls_file_and_set_xform(xls_file_path)
开发者ID:MichaelRoethlin,项目名称:onadata,代码行数:9,代码来源:test_form_submission.py

示例2: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     self.attachment_count = 0
     TestBase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
     self._submit_transport_instance_w_attachment()
     self.url = reverse(attachment_url, kwargs={"size": "original"})
开发者ID:hkmshb,项目名称:onadata,代码行数:9,代码来源:test_attachment_url.py

示例3: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.setUp(self)
     self._publish_transportation_form_and_submit_instance()
     self.url = reverse(charts, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string
     })
开发者ID:199212151746,项目名称:onadata,代码行数:9,代码来源:test_charts_view.py

示例4: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.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.instances.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:onaio,项目名称:onadata,代码行数:29,代码来源:test_form_permissions.py

示例5: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
     self.url = reverse(show, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string
     })
开发者ID:onaio,项目名称:onadata,代码行数:10,代码来源:test_form_show.py

示例6: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.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:onaio,项目名称:onadata,代码行数:10,代码来源:test_form_public_api.py

示例7: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.setUp(self)
     self._create_user_and_login(username='bob', password='bob')
     self._publish_transportation_form()
     self.api_url = reverse(views.api, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string
     })
     self._logout()
开发者ID:199212151746,项目名称:onadata,代码行数:11,代码来源:test_http_auth.py

示例8: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.setUp(self)
     self._publish_transportation_form()
     #
     self.csv_filepath = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         "fixtures", "test_update_xform_uuids.csv"
     )
     # get the last defined uuid
     with open(self.csv_filepath, "r") as f:
         lines = csv.reader(f)
         for line in lines:
             self.new_uuid = line[2]
开发者ID:199212151746,项目名称:onadata,代码行数:15,代码来源:test_update_xform_uuid.py

示例9: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.setUp(self)
     self.instances = settings.MONGO_DB.instances
     self.instances.remove()
     self.assertEquals(list(self.instances.find()), [])
     xls_path = os.path.join(self.this_directory, 'fixtures',
                             'transportation', 'mongo',
                             'transportation_with_dirty_mongo_ids.xls')
     count = XForm.objects.count()
     self._publish_xls_file(xls_path)
     self.assertEqual(XForm.objects.count(), count + 1)
     self.xform = XForm.objects.all().reverse()[0]
     self._make_submission(os.path.join(
         self.this_directory, 'fixtures', 'transportation', 'mongo',
         'transport_2011-07-25_19-05-36' + '.xml'))
     self.pi = self.xform.instances.all()[0].parsed_instance
开发者ID:199212151746,项目名称:onadata,代码行数:18,代码来源:test_mongo_data.py

示例10: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.setUp(self)
     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:onaio,项目名称:onadata,代码行数:21,代码来源:test_form_enter_data.py

示例11: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.setUp(self)
     self._publish_transportation_form()
     self._submit_transport_instance_w_attachment()
     src = os.path.join(self.this_directory, "fixtures",
                        "transportation", "screenshot.png")
     uf = UploadedFile(file=open(src), content_type='image/png')
     count = MetaData.objects.count()
     MetaData.media_upload(self.xform, uf)
     self.assertEqual(MetaData.objects.count(), count + 1)
     url = urljoin(
         self.base_url,
         reverse(profile, kwargs={'username': self.user.username})
     )
     self._logout()
     self._create_user_and_login('deno', 'deno')
     self.bc = BriefcaseClient(
         username='bob', password='bob',
         url=url,
         user=self.user
     )
开发者ID:cagulas,项目名称:onadata,代码行数:23,代码来源:test_briefcase_client.py

示例12: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
    def setUp(self):
        TestBase.setUp(self)
        self._create_user_and_login()
        self.extra = {'HTTP_AUTHORIZATION': 'Token %s' % self.user.auth_token}

        self.xls_file_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            "../fixtures/tutorial/tutorial.xls"
        )

        self._publish_transportation_form_and_submit_instance()
        self.project = Project.objects.create(name="Test Project",
                                              organization=self.user,
                                              created_by=self.user)
        self.xform.project = self.project
        self.xform.save()

        self.instance = self.xform.instances.first()
        self._add_external_export_metadata(self.instance)

        self.view = MetaDataViewSet.as_view({'get': 'list'})

        ContentType.objects.get_or_create(app_label="logger", model="instance")
开发者ID:onaio,项目名称:onadata,代码行数:25,代码来源:test_instance_permission_filter.py

示例13: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.setUp(self)
开发者ID:onaio,项目名称:onadata,代码行数:4,代码来源:test_form_auth.py

示例14: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
     self.url = reverse(clone_xlsform,
                        kwargs={'username': self.user.username})
开发者ID:onaio,项目名称:onadata,代码行数:8,代码来源:test_form_gallery.py

示例15: setUp

# 需要导入模块: from onadata.apps.main.tests.test_base import TestBase [as 别名]
# 或者: from onadata.apps.main.tests.test_base.TestBase import setUp [as 别名]
 def setUp(self):
     TestBase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
开发者ID:Azique,项目名称:kobocat,代码行数:6,代码来源:test_create_default_project.py


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