本文整理汇总了Python中metashare.test_utils.set_index_active函数的典型用法代码示例。如果您正苦于以下问题:Python set_index_active函数的具体用法?Python set_index_active怎么用?Python set_index_active使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_index_active函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUpClass
def setUpClass(cls):
"""
Import a resource to test the workflow changes for
"""
LOGGER.info("running '{}' tests...".format(cls.__name__))
test_utils.set_index_active(False)
test_utils.setup_test_storage()
_test_editor_group = \
EditorGroup.objects.create(name='test_editor_group')
_test_manager_group = \
EditorGroupManagers.objects.create(name='test_manager_group',
managed_group=_test_editor_group)
owner = test_utils.create_manager_user(
'manageruser', '[email protected]', 'secret',
(_test_editor_group, _test_manager_group))
# load first resource
_fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
_result = test_utils.import_xml(_fixture)
_result.editor_groups.add(_test_editor_group)
_result.owners.add(owner)
# load second resource
_fixture = '{0}/repository/test_fixtures/ingested-corpus-AudioVideo-French.xml'.format(ROOT_PATH)
_result = test_utils.import_xml(_fixture)
_result.editor_groups.add(_test_editor_group)
_result.owners.add(owner)
# create a normal user
test_utils.create_user('user', '[email protected]', 'mypasswd')
开发者ID:Atala,项目名称:META-SHARE,代码行数:29,代码来源:tests.py
示例2: tearDown
def tearDown(self):
"""
Clean up the test
"""
test_utils.clean_resources_db()
test_utils.clean_storage()
test_utils.clean_user_db()
test_utils.set_index_active(True)
开发者ID:ELDAELRA,项目名称:META-SHARE-3.1.1,代码行数:8,代码来源:test_status_workflow.py
示例3: tearDownClass
def tearDownClass(cls):
"""
Clean up the test
"""
test_utils.clean_resources_db()
test_utils.clean_storage()
test_utils.clean_user_db()
test_utils.set_index_active(True)
LOGGER.info("finished '{}' tests".format(cls.__name__))
开发者ID:Atala,项目名称:META-SHARE,代码行数:9,代码来源:tests.py
示例4: testSingleResourceView
def testSingleResourceView(self):
"""
Checks that each resource's single view is displayed correctly.
"""
# disable indexing; we don't need stat updates for this test
test_utils.set_index_active(False)
queryset = resourceInfoType_model.objects.all()
check_resource_view(queryset, self)
# enable indexing
test_utils.set_index_active(True)
开发者ID:JuliBakagianni,项目名称:CEF-ELRC,代码行数:13,代码来源:test_view.py
示例5: tearDownClass
def tearDownClass(cls):
"""
Clean up the test
"""
LOGGER.info("finished '{}' tests".format(cls.__name__))
# disable indexing during import
test_utils.set_index_active(False)
test_utils.clean_resources_db()
test_utils.clean_storage()
OBJECT_XML_CACHE.clear()
# enable indexing
test_utils.set_index_active(True)
# update index
update_index.Command().handle(using=[settings.TEST_MODE_NAME,])
开发者ID:ELDAELRA,项目名称:META-SHARE-3.1.1,代码行数:18,代码来源:test_view.py
示例6: deactivated_testSingleResourceViewAll
def deactivated_testSingleResourceViewAll(self):
"""
Checks that each resource's single view is displayed correctly.
"""
# disable indexing; we don't need stat updates for this test
test_utils.set_index_active(False)
count = 0
error_atts = []
for _res in resourceInfoType_model.objects.all():
parent_dict = {}
_res.export_to_elementtree(pretty=True, parent_dict=parent_dict)
count += 1
LOGGER.info("calling {}. resource at {}".format(
count, _res.get_absolute_url()))
# always create a new client to force a new session
client = Client()
response = client.get(_res.get_absolute_url(), follow = True)
self.assertEquals(200, response.status_code)
self.assertTemplateUsed(response, 'repository/lr_view.html')
for _ele in parent_dict:
if not _ele.text:
continue
text = smart_str(xml_utils.html_escape(_ele.text), response._charset)
real_count = response.content.count(text)
if real_count == 0:
path = self.path_to_root(_ele, parent_dict)
if "email" in path \
or "metaShareId" in path:
continue
LOGGER.error(u"missing {}: {}".format(path, _ele.text))
error_atts.append(path)
# TODO activate when single resource view is complete
#self.assertContains(response, xml_utils.html_escape(_ele.text))
if LOGGER.isEnabledFor(logging.WARN):
LOGGER.warn("missing paths:")
for path in sorted(set(error_atts)):
LOGGER.warn(path)
# enable indexing
test_utils.set_index_active(True)
开发者ID:jvivaldi,项目名称:META-SHARE,代码行数:43,代码来源:test_nightly.py
示例7: setUp
def setUp(self):
"""
Import a resource to test the workflow changes for
"""
test_utils.set_index_active(False)
test_utils.setup_test_storage()
_test_editor_group = \
EditorGroup.objects.create(name='test_editor_group')
_test_manager_group = \
EditorGroupManagers.objects.create(name='test_manager_group',
managed_group=_test_editor_group)
test_utils.create_manager_user(
'manageruser', '[email protected]', 'secret',
(_test_editor_group, _test_manager_group))
_fixture = '{0}/repository/fixtures/testfixture.xml'.format(ROOT_PATH)
_result = test_utils.import_xml(_fixture)
_result.editor_groups.add(_test_editor_group)
StatusWorkflowTest.resource_id = _result.id
开发者ID:ELDAELRA,项目名称:META-SHARE-3.1.1,代码行数:19,代码来源:test_status_workflow.py
示例8: tearDownClass
def tearDownClass(cls):
"""
Clean up the test
"""
LOGGER.info("finished '{}' tests".format(cls.__name__))
# disable indexing during import
test_utils.set_index_active(False)
test_utils.clean_resources_db()
test_utils.clean_storage()
OBJECT_XML_CACHE.clear()
# enable indexing
test_utils.set_index_active(True)
# update index
from django.core.management import call_command
call_command('rebuild_index', interactive=False, using=TEST_MODE_NAME)
开发者ID:JuliBakagianni,项目名称:CEF-ELRC,代码行数:19,代码来源:test_view.py
示例9: setUpClass
def setUpClass(cls):
"""
Set up the test
"""
LOGGER.info("running '{}' tests...".format(cls.__name__))
# disable indexing during import
test_utils.set_index_active(False)
# import resources
test_utils.setup_test_storage()
OBJECT_XML_CACHE.clear()
test_utils.import_xml_or_zip(RESOURCES_ZIP_FILE)
# enable indexing
test_utils.set_index_active(True)
# update index
from django.core.management import call_command
call_command('rebuild_index', interactive=False, using=TEST_MODE_NAME)
开发者ID:Atala,项目名称:META-SHARE,代码行数:20,代码来源:test_nightly.py
示例10: testSingleResourceView
def testSingleResourceView(self):
"""
Checks that each resource's single view is displayed correctly.
"""
# disable indexing; we don't need stat updates for this test
test_utils.set_index_active(False)
count = 0
for _res in resourceInfoType_model.objects.all():
count += 1
LOGGER.info("calling {}. resource at {}".format(count, _res.get_absolute_url()))
# always create a new client to force a new session
client = Client()
response = client.get(_res.get_absolute_url(), follow = True)
self.assertEquals(200, response.status_code)
self.assertTemplateUsed(response, 'repository/resource_view/lr_view.html')
self.assertContains(response, xml_utils.html_escape(_res.real_unicode_()))
# enable indexing
test_utils.set_index_active(True)
开发者ID:Atala,项目名称:META-SHARE,代码行数:21,代码来源:test_nightly.py
示例11: setUpClass
def setUpClass(cls):
"""
set up test users with and without sync permissions.
These will live in the test database only, so will not
pollute the "normal" development db or the production db.
As a consequence, they need no valuable password.
"""
LOGGER.info("running '{}' tests...".format(cls.__name__))
set_index_active(False)
test_utils.setup_test_storage()
syncuser = User.objects.create_user("syncuser", "[email protected]", "secret")
syncpermission = Permission.objects.get(codename="can_sync")
syncuser.user_permissions.add(syncpermission)
syncuser.save()
User.objects.create_user("normaluser", "[email protected]", "secret")
editoruser = User.objects.create_user("editoruser", "[email protected]", "secret")
editoruser.is_staff = True
globaleditors = Group.objects.get(name="globaleditors")
editoruser.groups.add(globaleditors)
editoruser.save()
# login POST dicts
MetadataSyncTest.syncuser_login = {LOGIN_FORM_KEY: 1, "username": "syncuser", "password": "secret"}
MetadataSyncTest.normal_login = {LOGIN_FORM_KEY: 1, "username": "normaluser", "password": "secret"}
MetadataSyncTest.editor_login = {LOGIN_FORM_KEY: 1, "username": "editoruser", "password": "secret"}
testres = cls.import_test_resource("testfixture.xml", INGESTED)
testres.storage_object.digest_modified = datetime.date(2012, 6, 1)
testres.storage_object.save()
cls.import_test_resource("roundtrip.xml", INTERNAL)
pubres = cls.import_test_resource("ILSP10.xml", PUBLISHED)
pubres.storage_object.digest_modified = datetime.date(2012, 1, 1)
pubres.storage_object.save()
开发者ID:JuliBakagianni,项目名称:CEF-ELRC,代码行数:40,代码来源:tests.py
示例12: setUpClass
def setUpClass(cls):
"""
Set up the test
"""
LOGGER.info("running '{}' tests...".format(cls.__name__))
# disable indexing during import
test_utils.set_index_active(False)
# import resources
test_utils.setup_test_storage()
OBJECT_XML_CACHE.clear()
test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
"partial-corpus.xml".format(ROOT_PATH))
test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
"full-lang-description.xml".format(ROOT_PATH))
test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
"full-lex-conceptual.xml".format(ROOT_PATH))
test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
"full-corpus-text.xml".format(ROOT_PATH))
test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
"full-corpus-image.xml".format(ROOT_PATH))
test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
"full-corpus-audio.xml".format(ROOT_PATH))
test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
"full-corpus-video.xml".format(ROOT_PATH))
test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
"full-corpus-textngram.xml".format(ROOT_PATH))
test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
"full-corpus-textnumerical.xml".format(ROOT_PATH))
test_utils.import_xml_or_zip("{}/repository/fixtures/full-resources/"
"full-tool-service.xml".format(ROOT_PATH))
# enable indexing
test_utils.set_index_active(True)
# update index
from django.core.management import call_command
call_command('rebuild_index', interactive=False, using=TEST_MODE_NAME)
开发者ID:JuliBakagianni,项目名称:CEF-ELRC,代码行数:39,代码来源:test_view.py
示例13: tearDownClass
def tearDownClass(cls):
# delete content of storage folder
test_utils.clean_storage()
test_utils.set_index_active(True)
LOGGER.info("finished '{}' tests".format(cls.__name__))
开发者ID:Atala,项目名称:META-SHARE,代码行数:5,代码来源:test_persistence.py
示例14: setUpClass
def setUpClass(cls):
LOGGER.info("running '{}' tests...".format(cls.__name__))
test_utils.set_index_active(False)
test_utils.setup_test_storage()
# copy fixtures to storage folder
copy_fixtures()
开发者ID:Atala,项目名称:META-SHARE,代码行数:6,代码来源:test_persistence.py
示例15: tearDownClass
def tearDownClass(cls):
User.objects.all().delete()
StorageObject.objects.all().delete()
set_index_active(True)
开发者ID:marc1s,项目名称:META-SHARE,代码行数:4,代码来源:tests.py
注:本文中的metashare.test_utils.set_index_active函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论