當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。