本文整理汇总了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
示例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')
示例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)
示例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()
示例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()
示例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()
示例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
示例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()
示例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()
示例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'
示例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()
示例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()
示例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()
示例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()