本文整理汇总了Python中onadata.apps.main.tests.test_base.TestBase类的典型用法代码示例。如果您正苦于以下问题:Python TestBase类的具体用法?Python TestBase怎么用?Python TestBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
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
})
示例2: setUp
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)
示例3: setUp
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
})
示例4: setUp
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"})
示例5: setUp
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
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
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: _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()
TestBase._publish_xls_file(self, xls_path)
self.assertEqual(XForm.objects.count(), count + 1)
self.xform = XForm.objects.all().reverse()[0]
示例9: setUp
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]
示例10: setUp
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
示例11: setUp
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,
},
)
示例12: setUp
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
)
示例13: setUp
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")
示例14: setUp
def setUp(self):
TestBase.setUp(self)
示例15: _publish_survey
def _publish_survey(self):
self.this_directory = os.path.dirname(__file__)
xls_path = self._fixture_path("gps", "gps.xls")
TestBase._publish_xls_file(self, xls_path)