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


Python DguCreateTestData.form_package方法代码示例

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


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

示例1: assert_create_or_edit

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import form_package [as 别名]
 def assert_create_or_edit(self, create_or_edit, user_name, allowed=True):
     if create_or_edit == "create":
         package_data = _EXAMPLE_TIMESERIES_DATA.copy()
         package_data["name"] = "tstcreate" + user_name
         package_data["groups__0__name"] = "national-health-service"
         package_name = package_data["name"]
         package_id = None
     else:
         package_data = {}
         package_id = DguCreateTestData.form_package().id
         package_name = DguCreateTestData.form_package().name
     response = self._form_client.post_form(
         package_data, id=package_id, user_name=user_name, use_sysadmin_to_get_form=True, abort_on_bad_status=False
     )
     redirect = response.header_dict.get("Location", "")
     dataset_read_path = "/dataset/%s" % package_name
     if allowed:
         # 200 means there are form errors
         assert response.status != 200, response.body
         # 302 is what is wanted - a redirect to the package read page
         assert_equal(response.status, 302)
         assert dataset_read_path in redirect, redirect
     else:
         assert_equal(response.status, 401)
         assert dataset_read_path not in redirect, redirect
         # also assert that you couldn't get the form in the first place
         assert_raises(
             paste.fixture.AppError,
             self._form_client.post_form,
             package_data,
             user_name=user_name,
             use_sysadmin_to_get_form=False,
             abort_on_bad_status=False,
         )
开发者ID:diabulos,项目名称:ckanext-dgu,代码行数:36,代码来源:test_package_form.py

示例2: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import form_package [as 别名]
 def setup_class(cls):
     DguCreateTestData.create_dgu_test_data()
     cls.pkg_name = DguCreateTestData.form_package().name
     cls.pkg_id = DguCreateTestData.form_package().id
     cls.extra_environ_editor = {"Authorization": str(model.User.by_name("nhseditor").apikey)}
     cls.extra_environ_admin = {"Authorization": str(model.User.by_name("nhsadmin").apikey)}
     cls.extra_environ_sysadmin = {"Authorization": str(model.User.by_name("sysadmin").apikey)}
     cls.context = {"model": model, "session": model.Session, "user": ""}
开发者ID:datagovuk,项目名称:ckanext-dgu,代码行数:10,代码来源:test_api.py

示例3: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import form_package [as 别名]
 def setup_class(cls):
     DguCreateTestData.create_dgu_test_data()
     cls.pkg_name = DguCreateTestData.form_package().name
     cls.pkg_id = DguCreateTestData.form_package().id
     cls.extra_environ_editor = {
         'Authorization': str(model.User.by_name('nhseditor').apikey)}
     cls.extra_environ_admin = {
         'Authorization': str(model.User.by_name('nhsadmin').apikey)}
     cls.extra_environ_sysadmin = {
         'Authorization': str(model.User.by_name('sysadmin').apikey)}
     cls.context = {'model': model, 'session': model.Session,
                    'user': ''}
开发者ID:ArunEG,项目名称:ckanext-dgu,代码行数:14,代码来源:test_api.py

示例4: test_basic_dataset

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import form_package [as 别名]
    def test_basic_dataset(self):
        DguCreateTestData.create_dgu_test_data()
        pkg_name = DguCreateTestData.form_package().name
        context = {"model": model, "session": model.Session, "user": "nhseditor"}

        pkg = get_action("package_show")(context, {"id": pkg_name})
        get_action("package_update")(context, pkg)
开发者ID:datagovuk,项目名称:ckanext-dgu,代码行数:9,代码来源:test_api.py


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