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


Python CreateTestData.create方法代码示例

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


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

示例1: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
 def setup_class(cls):
     CreateTestData.create()
     cls.app = paste.fixture.TestApp(pylons.test.pylonsapp)
     joeadmin = ckan.model.User.get("joeadmin")
     cls.joeadmin = {"id": joeadmin.id, "apikey": joeadmin.apikey}
     annafan = ckan.model.User.get("annafan")
     cls.annafan = {"id": annafan.id, "apikey": annafan.apikey}
     testsysadmin = ckan.model.User.get("testsysadmin")
     cls.testsysadmin = {"id": testsysadmin.id, "apikey": testsysadmin.apikey}
     cls.new_user = cls.user_create()
开发者ID:chrismajewski,项目名称:ckan,代码行数:12,代码来源:test_dashboard.py

示例2: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
 def setup_class(cls):
     cls._original_config = config.copy()
     for key in config.keys():
         if key.startswith('ofs'):
             del config[key]
     config['ckan.storage.bucket'] = 'ckantest'
     config['ofs.impl'] = 'pairtree'
     config['ofs.storage_dir'] = '/tmp/ckan-test-ckanext-storage'
     create_pairtree_marker( config['ofs.storage_dir'] )
     wsgiapp = make_app(config['global_conf'], **config)
     cls.app = paste.fixture.TestApp(wsgiapp)
     CreateTestData.create()
     model.Session.remove()
     user = model.User.by_name('tester')
     cls.extra_environ = {'Authorization': str(user.apikey)}
开发者ID:Accela-Inc,项目名称:ckan,代码行数:17,代码来源:test_storage.py

示例3: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
 def setup_class(cls):
     CreateTestData.create()
     cls.app = paste.fixture.TestApp(pylons.test.pylonsapp)
     joeadmin = ckan.model.User.get('joeadmin')
     cls.joeadmin = {
             'id': joeadmin.id,
             'apikey': joeadmin.apikey
             }
     annafan = ckan.model.User.get('annafan')
     cls.annafan = {
             'id': annafan.id,
             'apikey': annafan.apikey
             }
     testsysadmin = ckan.model.User.get('testsysadmin')
     cls.testsysadmin = {
             'id': testsysadmin.id,
             'apikey': testsysadmin.apikey
             }
     cls.new_user = cls.user_create()
开发者ID:DavidLemayian,项目名称:ckan,代码行数:21,代码来源:test_dashboard.py

示例4: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
 def setup_class(cls):
     ckan.model.repo.rebuild_db()
     ckan.lib.search.clear_all()
     CreateTestData.create()
     cls.app = helpers._get_test_app()
     joeadmin = ckan.model.User.get('joeadmin')
     cls.joeadmin = {
             'id': joeadmin.id,
             'apikey': joeadmin.apikey
             }
     annafan = ckan.model.User.get('annafan')
     cls.annafan = {
             'id': annafan.id,
             'apikey': annafan.apikey
             }
     testsysadmin = ckan.model.User.get('testsysadmin')
     cls.testsysadmin = {
             'id': testsysadmin.id,
             'apikey': testsysadmin.apikey
             }
     cls.new_user = cls.user_create()
开发者ID:jqnatividad,项目名称:ckan,代码行数:23,代码来源:test_dashboard.py

示例5: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
    def setup_class(cls):
        smtp_server = config.get('smtp.test_server')
        if smtp_server:
            host, port = smtp_server.split(':')
            port = int(port) + int(str(hashlib.md5(cls.__name__).hexdigest())[0], 16)
            config['smtp.test_server'] = '%s:%s' % (host, port)

        SmtpServerHarness.setup_class()
        CreateTestData.create()

        # make 3 changes, authored by annafan
        for i in range(3):
            rev = model.repo.new_revision()
            pkg = model.Package.by_name(u'annakarenina')
            pkg.notes = u'Changed notes %i' % i
            rev.author = u'annafan'
            model.repo.commit_and_remove()

        CreateTestData.create_user('unfinisher', about='<a href="http://unfinished.tag')
        CreateTestData.create_user('uncloser', about='<a href="http://unclosed.tag">')
        CreateTestData.create_user('spammer', about=u'<a href="http://mysite">mysite</a> <a href=\u201dhttp://test2\u201d>test2</a>')
        CreateTestData.create_user('spammer2', about=u'<a href="http://spamsite1.com\u201d>spamsite1</a>\r\n<a href="http://www.spamsite2.com\u201d>spamsite2</a>\r\n')
开发者ID:PublicaMundi,项目名称:ckan,代码行数:24,代码来源:test_user.py

示例6: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
    def setup_class(cls):
        setup_test_search_index()
        # Force a garbage collection to trigger issue #695
        import gc
        gc.collect()

        CreateTestData.create()

        cls.new_pkg_dict = {
            'name': 'council-owned-litter-bins',
            'notes': 'Location of Council owned litter bins within Borough.',
            'resources': [{'description': 'Resource locator',
                           'format': 'Unverified',
                           'url': 'http://www.barrowbc.gov.uk'}],
            'tags': ['Utility and governmental services'],
            'title': 'Council Owned Litter Bins',
            'extras': {
                'INSPIRE': 'True',
                'bbox-east-long': '-3.12442',
                'bbox-north-lat': '54.218407',
                'bbox-south-lat': '54.039634',
                'bbox-west-long': '-3.32485',
                'constraint': 'conditions unknown; (e) intellectual property rights;',
                'dataset-reference-date': json.dumps(
                                          [{'type': 'creation',
                                            'value': '2008-10-10'},
                                           {'type': 'revision',
                                            'value': '2009-10-08'}]),
                'guid': '00a743bf-cca4-4c19-a8e5-e64f7edbcadd',
                'metadata-date': '2009-10-16',
                'metadata-language': 'eng',
                'published_by': 0,
                'resource-type': 'dataset',
                'spatial-reference-system': 'test-spatial',
                'temporal_coverage-from': '1977-03-10T11:45:30',
                'temporal_coverage-to': '2005-01-15T09:10:00'
            }
        }
开发者ID:CIOIL,项目名称:DataGovIL,代码行数:40,代码来源:test_solr_package_search_synchronous_update.py

示例7: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
    def setup_class(self):
        model.Session.remove()
        CreateTestData.create()
        self.name = u'revisiontest'

        # create pkg
        self.descriptions = [u'Written by Puccini', u'Written by Rossini', u'Not written at all', u'Written again', u'Written off']
        rev = model.repo.new_revision()
        self.grp = model.Group(name=self.name)
        model.Session.add(self.grp)
        self.grp.description = self.descriptions[0]
        self.grp.extras['mykey'] = self.descriptions[0]
        model.repo.commit_and_remove()

        # edit pkg
        for i in range(5)[1:]:
            rev = model.repo.new_revision()
            grp = model.Group.by_name(self.name)
            grp.description = self.descriptions[i]
            grp.extras['mykey'] = self.descriptions[i]
            model.repo.commit_and_remove()

        self.grp = model.Group.by_name(self.name)        
开发者ID:Atharex,项目名称:ckan,代码行数:25,代码来源:test_group.py

示例8: setup

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
 def setup(cls):
     if not asbool(config.get('ckan.activity_streams_enabled', 'true')):
         raise SkipTest('Activity streams not enabled')
     CreateTestData.create()
     cls.sysadmin_user = ckan.model.User.get('testsysadmin')
     cls.app = helpers._get_test_app()
开发者ID:jqnatividad,项目名称:ckan,代码行数:8,代码来源:test_activity.py

示例9: setup

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
 def setup(cls):
     if not asbool(config.get('ckan.activity_streams_enabled', 'true')):
         raise SkipTest('Activity streams not enabled')
     CreateTestData.create()
     cls.sysadmin_user = ckan.model.User.get('testsysadmin')
     cls.app = paste.fixture.TestApp(pylonsapp)
开发者ID:berlinonline,项目名称:ckan,代码行数:8,代码来源:test_activity.py

示例10: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
 def setup_class(cls):
     # setup test data including testsysadmin user
     CreateTestData.create()
开发者ID:PublicaMundi,项目名称:ckan,代码行数:5,代码来源:test_admin.py

示例11: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
 def setup_class(cls):
     setup_test_search_index()
     CreateTestData.create()
开发者ID:6779660,项目名称:ckan,代码行数:5,代码来源:test_solr_package_search.py

示例12: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
 def setup_class(self):
     model.Session.remove()
     # rebuild db before this test as it depends delicately on what
     # revisions exist
     model.repo.init_db()
     CreateTestData.create()
开发者ID:marcfor,项目名称:ckan,代码行数:8,代码来源:test_revision.py

示例13: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
 def setup_class(self):
     model.repo.rebuild_db()
     CreateTestData.create()
开发者ID:And0rz,项目名称:ckan,代码行数:5,代码来源:test_dumper.py

示例14: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create [as 别名]
 def setup_class(cls):
     # setup test data including testsysadmin user
     CreateTestData.create()
     model.Session.commit()
开发者ID:Atharex,项目名称:ckan,代码行数:6,代码来源:test_admin.py


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