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


Python DguCreateTestData.create_dgu_test_data方法代码示例

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


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

示例1: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
    def setup_class(cls):
        DguCreateTestData.create_dgu_test_data()
        cls.publisher_controller = 'ckanext.dgu.controllers.publisher:PublisherController'

        # monkey patch webtest to support multiple select boxes
        Field.classes['multiple_select'] = MultipleSelect
        Form._parse_fields = _parse_fields
开发者ID:datagovuk,项目名称:ckanext-dgu,代码行数:9,代码来源:test_publisher_forms.py

示例2: command

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
    def command(self):
        self._load_config()
        self._setup_app()

        # Now we can import
        from ckan import plugins
        from ckanext.dgu.testtools.create_test_data import DguCreateTestData
        
        try:
            plugins.load('synchronous_search') # so packages get indexed
        except:
            pass

        self.log = logging.getLogger(__name__)

        if self.args:
            cmd = self.args[0]
        else:
            cmd = 'basic'
        if cmd == 'basic':
            DguCreateTestData.create_dgu_test_data()
        elif cmd == 'users':
            DguCreateTestData.create_dgu_test_users()
        else:
            print 'Command %s not recognized' % cmd
            raise NotImplementedError
        
        self.log.info('Created DGU test data successfully')
开发者ID:ArunEG,项目名称:ckanext-dgu,代码行数:30,代码来源:cli.py

示例3: test_basic_dataset

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [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

示例4: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
 def setup_class(cls):
     search.clear()
     cls.tsi = TestSearchIndexer()
     DguCreateTestData.create_dgu_test_data()
     DguCreateTestData.create_arbitrary(
         {"name": "latest", "notes": "<b>Latest</b> dataset.", "groups": ["national-health-service"]}
     )
     cls.tsi.index()
开发者ID:datagovuk,项目名称:ckanext-dgu,代码行数:10,代码来源:test_api.py

示例5: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
 def setup_class(cls):
     search.clear()
     cls.tsi = TestSearchIndexer()
     DguCreateTestData.create_dgu_test_data()
     DguCreateTestData.create_arbitrary({'name': 'latest',
                                         'notes': '<b>Latest</b> dataset.',
                                         'groups': ['national-health-service']})
     cls.tsi.index()
开发者ID:ArunEG,项目名称:ckanext-dgu,代码行数:10,代码来源:test_api.py

示例6: test_1_edit_publisher

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
    def test_1_edit_publisher(self):
        # Load form
        publisher_name = 'national-health-service'
        group = model.Group.by_name(publisher_name)
        offset = url_for('/publisher/edit/%s' % publisher_name)
        res = self.app.get(offset, status=200, extra_environ={'REMOTE_USER': 'nhsadmin'})
        assert 'Edit Publisher' in res, res
        form = res.forms[1]
        # TODO assert_equal(form['title'].value, 'National Health Service')
        assert_equal(form['name'].value, 'national-health-service')
        assert_equal(form['description'].value, '')
        # TODO assert_equal(form['parent'].value, 'dept-health')
        assert_equal(form['contact-name'].value, '')
        assert_equal(form['contact-email'].value, '[email protected]')
        assert_equal(form['foi-name'].value, '')
        assert_equal(form['foi-email'].value, '')
        assert_equal(form['foi-web'].value, '')
        assert_equal(form['category'].value, 'grouping')
        assert_equal(form['abbreviation'].value, 'NHS')

        # Make edit
        publisher_name = 'new-name'
        form['name'] = publisher_name
        form['description'] = 'New description'
        form['contact-name'] = 'Head of Comms'
        form['contact-email'] = '[email protected]'
        form['contact-phone'] = '01234 4567890'
        form['foi-name'] = 'Head of FOI Comms'
        form['foi-email'] = '[email protected]'
        form['foi-phone'] = '0845 4567890'
        form['foi-web'] = 'http://whatdotheyknow.com'
        form['category'] = 'non-ministerial-department'
        form['abbreviation'] = 'nhs'
        res = form.submit('save', status=302, extra_environ={'REMOTE_USER': 'nhsadmin'})

        # The return value is /organization, which routing then redirects to publisher
        assert_equal(res.header_dict['Location'], 'http://localhost/organization/new-name')

        # Check saved object
        publisher = model.Group.by_name(publisher_name)

        assert_equal(publisher.description, 'New description')
        assert_equal(publisher.extras['contact-name'], 'Head of Comms')
        assert_equal(publisher.extras['contact-email'], '[email protected]')
        assert_equal(publisher.extras['contact-phone'], '01234 4567890')
        assert_equal(publisher.extras['foi-name'], 'Head of FOI Comms')
        assert_equal(publisher.extras['foi-email'], '[email protected]')
        assert_equal(publisher.extras['foi-phone'], '0845 4567890')
        assert_equal(publisher.extras['foi-web'], 'http://whatdotheyknow.com')
        assert_equal(publisher.extras['category'], 'non-ministerial-department')
        assert_equal(publisher.extras['abbreviation'], 'nhs')

        # restore name for other tests
        #model.repo.new_revision()
        #publisher.name = 'national-health-service'
        #model.repo.commit_and_remove()
        model.repo.rebuild_db()
        DguCreateTestData.create_dgu_test_data()
开发者ID:datagovuk,项目名称:ckanext-dgu,代码行数:60,代码来源:test_publisher_forms.py

示例7: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
 def setup_class(cls):
     DguCreateTestData.create_dgu_test_data()
     DguCreateTestData.create_arbitrary({'name': 'latest',
                                         'notes': '<b>Latest</b> dataset.',
                                         'tags': ['tag1', 'tag2'],
                                         'extras': {'key': 'value'},
                                         'groups': ['national-health-service']})
     cls._assert_revision_created()
     model.Session.remove() # ensure last revision appears
开发者ID:CarlQLange,项目名称:ckanext-dgu,代码行数:11,代码来源:test_api.py

示例8: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
 def setup_class(cls):
     DguCreateTestData.create_dgu_test_data()
     cls.publisher_controller = 'ckanext.dgu.controllers.publisher:PublisherController'
     SmtpServerHarness.setup_class()
开发者ID:diabulos,项目名称:ckanext-dgu,代码行数:6,代码来源:test_publisher_forms.py

示例9: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
 def setup_class(cls):
     DguCreateTestData.create_dgu_test_data()
开发者ID:diabulos,项目名称:ckanext-dgu,代码行数:4,代码来源:test_publisher.py

示例10: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
 def setup_class(cls):
     DguCreateTestData.create_dgu_test_data()
     cls.inv_controller = 'ckanext.dgu.controllers.inventory:InventoryController'
开发者ID:CarlQLange,项目名称:ckanext-dgu,代码行数:5,代码来源:test_inventory.py

示例11: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
 def setup_class(cls):
     DguCreateTestData.create_dgu_test_data()
     model.repo.new_revision()
开发者ID:afjensen,项目名称:ckanext-dgu,代码行数:5,代码来源:test_resource_changes.py

示例12: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
 def setup_class(cls):
     helpers.reset_db()
     PylonsTestCase.setup_class()
     DguCreateTestData.create_dgu_test_data()
开发者ID:datagovuk,项目名称:ckanext-dgu,代码行数:6,代码来源:test_helpers.py

示例13: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
 def setup_class(cls):
     PylonsTestCase.setup_class()
     DguCreateTestData.create_dgu_test_data()
开发者ID:heinlja,项目名称:ckanext-dgu-old,代码行数:5,代码来源:test_helpers.py

示例14: setup_class

# 需要导入模块: from ckanext.dgu.testtools.create_test_data import DguCreateTestData [as 别名]
# 或者: from ckanext.dgu.testtools.create_test_data.DguCreateTestData import create_dgu_test_data [as 别名]
 def setup_class(cls):
     cls._form_client = _PackageFormClient()
     DguCreateTestData.create_dgu_test_data()
开发者ID:diabulos,项目名称:ckanext-dgu,代码行数:5,代码来源:test_package_form.py


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