本文整理汇总了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)
示例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"})
示例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
})
示例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
})
示例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
})
示例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
})
示例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()
示例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]
示例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
示例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,
},
)
示例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
)
示例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")
示例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)
示例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})
示例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()