本文整理汇总了Python中localground.apps.site.api.tests.base_tests.ViewMixinAPI.setUp方法的典型用法代码示例。如果您正苦于以下问题:Python ViewMixinAPI.setUp方法的具体用法?Python ViewMixinAPI.setUp怎么用?Python ViewMixinAPI.setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类localground.apps.site.api.tests.base_tests.ViewMixinAPI
的用法示例。
在下文中一共展示了ViewMixinAPI.setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self)
self.view = views.RecordInstance.as_view()
self.dataset = self.create_dataset_with_fields(num_fields=7)
self.metadata = get_metadata()
self.metadata.update({
'project_id':
{'read_only': True, 'required': True, 'type': 'field'}
})
self.markerwattrs = self.create_record(
self.user, self.project, dataset=self.dataset)
self.urls = [
'/api/0/datasets/%s/data/%s/' %
(self.markerwattrs.dataset.id, self.markerwattrs.id)
]
self.list_url = '/api/0/datasets/%s/data/' % self.dataset.id
self.hstore_data = [
{'field_1': 'field_1 text'},
{'field_2': 77},
{'field_3': '2012-09-04 06:00:00'},
{'field_4': True},
{'field_5': 43124.543252},
{'field_6': 2},
{'field_7': 'Independent'}
]
示例2: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self)
self.urls = ['/api/0/tiles/1/', '/api/0/tiles/2/', '/api/0/tiles/3/']
self.view = views.TileSetInstance.as_view()
self.metadata = {
'id': {'type': 'integer', 'required': False, 'read_only': True},
'url': {'type': 'field', 'required': False, 'read_only': True},
'name': {'type': 'string', 'required': False, 'read_only': False},
'tags': {'type': 'field', 'required': False, 'read_only': False},
'overlay_source': {'type': 'field', 'required': True,
'read_only': False},
'base_tile_url': {'type': 'string', 'required': False,
'read_only': False},
'base_static_url': {'type': 'string', 'required': False,
'read_only': False},
'source_name': {'type': 'field', 'required': False,
'read_only': True},
'max_zoom': {'type': 'integer', 'required': False,
'read_only': False},
'min_zoom': {'type': 'integer', 'required': False,
'read_only': False},
'is_printable': {'type': 'boolean', 'required': False,
'read_only': False},
'extras': {'type': 'json', 'required': False, 'read_only': False},
'key': {'type': 'string', 'required': False, 'read_only': False},
'owner': {'type': 'field', 'required': False, 'read_only': True},
'attribution': {'type': 'string', 'required': False,
'read_only': False}
}
示例3: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self, load_fixtures=False)
self.dataset = self.create_dataset_with_fields(
name="Class Dataset", num_fields=7)
# requery:
self.dataset = models.Dataset.objects.get(id=self.dataset.id)
self.record = self.create_record(
self.user, self.project, dataset=self.dataset)
# self.record = self.insert_dataset_data_record(
# dataset=self.dataset, project=self.project
# )
self.urls = [
'/api/0/datasets/%s/data/%s/%s/' % (
self.dataset.id, self.record.id, 'photos'
),
'/api/0/datasets/%s/data/%s/%s/' % (
self.dataset.id, self.record.id, 'audio'
)
]
self.metadata = {
"object_id": {"type": "integer", "required": True,
"read_only": False},
"ordering": {"type": "integer", "required": False,
"read_only": True},
"relation": {"type": "field", "required": False, "read_only": True}
}
self.view = views.RelatedMediaList.as_view()
# create 1 photo and 1 audio object:
self.photo = self.create_photo(self.user, self.project)
self.audio = self.create_audio(self.user, self.project)
示例4: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self)
self.obj = self.create_layer(self.user, name="Test Layer 1", authority_id=1)
self.url = "/api/0/layers/%s/" % self.obj.id
self.urls = [self.url]
self.model = models.Layer
self.view = views.LayerInstance.as_view()
示例5: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self, load_fixtures=True)
self.obj = self.create_snapshot(self.user, name="Test Snapshot 1", authority_id=1)
self.url = "/api/0/snapshots/%s/" % self.obj.id
self.urls = [self.url]
self.model = models.Snapshot
self.view = views.SnapshotInstance.as_view()
示例6: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self)
self.url = '/api/0/maps/?project_id={0}'.format(self.project.id)
self.urls = [self.url]
self.model = models.StyledMap
self.view = views.MapList.as_view()
self.metadata = get_metadata()
示例7: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self)
self.url = '/api/0/projects/'
self.urls = [self.url]
self.model = models.Project
self.view = views.ProjectList.as_view()
self.metadata = get_metadata()
示例8: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self)
self.user_profile = models.UserProfile.objects.get(user_id=self.user.id)
self.user_profile.email_announcements = False
self.user_profile.save()
self.user.first_name = 'Lary'
self.user.last_name = 'Grawl'
self.user.email = '[email protected]'
self.user.save()
self.urls = ['/api/0/user-profile/%s/.json' % self.user_profile.id]
self.url = self.urls[0]
self.view = views.UserProfileInstance.as_view()
self.metadata = {
"url": { "type": "field", "required": False, "read_only": True },
"id": { "type": "integer", "required": False, "read_only": True },
"first_name": { "type": "string", "required": False, "read_only": False },
"last_name": { "type": "string", "required": False, "read_only": False },
"email": { "type": "string", "required": False, "read_only": False },
"username": { "type": "string", "required": False, "read_only": True },
"email_announcements": { "type": "boolean", "required": True, "read_only": False },
"default_view_authority": { "type": "field", "required": False, "read_only": False },
"default_location": { "type": "geojson", "required": False, "read_only": False },
"contacts":{ "type": "field", "required": False, "read_only": True },
"date_created": { "type": "datetime", "required": False, "read_only": True },
"time_stamp": { "type": "datetime", "required": False, "read_only": True },
"user": { "type": "field", "required": False, "read_only": True }
}
示例9: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self, load_fixtures=False)
self.photo = self.create_photo_with_file()
self.url = '/api/0/photos/%s/' % self.photo.id
self.urls = [self.url]
self.view = views.PhotoInstance.as_view()
self.metadata = get_metadata()
self.metadata.update({"media_file": { "type": "string", "required": False, "read_only": True }})
示例10: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self)
self.dataset_1 = self.create_dataset_with_fields()
self.project_1 = self.create_project()
self.dataset_2 = self.create_dataset_with_fields(project=self.project_1)
self.urls = ['/api/0/datasets/']
self.view = views.DatasetList.as_view()
self.metadata = get_metadata_dataset()
示例11: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self)
self.form = self.create_form_with_fields(
name="Class Form",
num_fields=6)
self.url = '/api/0/forms/%s/data/' % self.form.id
self.urls = [self.url]
self.view = views.FormDataList.as_view()
示例12: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self, load_fixtures=True)
self.audio = models.Audio.objects.get(id=1)
self.url = '/api/0/audio/%s/' % self.audio.id
self.urls = [self.url]
self.view = views.AudioInstance.as_view()
self.metadata = get_metadata()
self.metadata.update({"media_file": { "type": "string", "required": False, "read_only": True }})
示例13: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self)
#self.urls = ['/api/0/icons/']
self.urls = ['/api/0/icons/?project_id=%s' % self.project.id]
self.url = self.urls[0]
self.create_icon(self.user, self.project, icon_file='icon1.jpg', name='test_icon_1', size=100, anchor_x=30, anchor_y=20)
self.create_icon(self.user, self.project, icon_file='icon2.jpg', name='test_icon_2', size=200, anchor_x=100, anchor_y=100)
self.view = views.IconList.as_view()
self.metadata = get_metadata()
示例14: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self)
self.url = '/api/0/prints/'
self.urls = [self.url]
self.view = views.PrintList.as_view()
self.point = {
"type": "Point",
"coordinates": [12.492324113849, 41.890307434153]
}
示例15: setUp
# 需要导入模块: from localground.apps.site.api.tests.base_tests import ViewMixinAPI [as 别名]
# 或者: from localground.apps.site.api.tests.base_tests.ViewMixinAPI import setUp [as 别名]
def setUp(self):
ViewMixinAPI.setUp(self)
self.view = views.SharingList.as_view()
self.metadata = get_metadata()
self.metadata.update({
'user': {'read_only': False, 'required': True, 'type': 'field'}
})
self.url = '/api/0/projects/' + str(self.project.id) + '/users/.json'
self.urls = [self.url]