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


Python utils.run_celery_tasks函数代码示例

本文整理汇总了Python中tests.utils.run_celery_tasks函数的典型用法代码示例。如果您正苦于以下问题:Python run_celery_tasks函数的具体用法?Python run_celery_tasks怎么用?Python run_celery_tasks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_index_on_submission_privacy_changes

    def test_index_on_submission_privacy_changes(self):
        # test_submissions_turned_private_are_deleted_from_index
        docs = query_collections('Salif Keita')['results']
        assert_equal(len(docs), 0)

        self.collection_public.collect_object(self.node_one, self.user)
        self.collection_one.collect_object(self.node_one, self.user)

        docs = query_collections('Salif Keita')['results']
        assert_equal(len(docs), 2)

        with run_celery_tasks():
            self.node_one.is_public = False
            self.node_one.save()

        docs = query_collections('Salif Keita')['results']
        assert_equal(len(docs), 0)

        # test_submissions_turned_public_are_added_to_index
        self.collection_public.collect_object(self.node_private, self.user)

        docs = query_collections('Salif Keita')['results']
        assert_equal(len(docs), 0)

        with run_celery_tasks():
            self.node_private.is_public = True
            self.node_private.save()

        docs = query_collections('Salif Keita')['results']
        assert_equal(len(docs), 1)
开发者ID:erinspace,项目名称:osf.io,代码行数:30,代码来源:test_elastic_search.py

示例2: test_retraction_wiki_content_is_not_searchable

    def test_retraction_wiki_content_is_not_searchable(self):
        # Add unique string to wiki
        wiki_content = {'home': 'public retraction test'}
        for key, value in wiki_content.items():
            docs = query(value)['results']
            assert_equal(len(docs), 0)
            with run_celery_tasks():
                self.registration.update_node_wiki(
                    key, value, self.consolidate_auth,
                )
            # Query and ensure unique string shows up
            docs = query(value)['results']
            assert_equal(len(docs), 1)

        # Query and ensure registration does show up
        docs = query('category:registration AND ' + self.title)['results']
        assert_equal(len(docs), 1)

        # Retract registration
        self.registration.retract_registration(self.user, '')
        self.registration.retraction.state = Retraction.APPROVED
        with run_celery_tasks():
            self.registration.retraction.save()
            self.registration.save()
            self.registration.update_search()

        # Query and ensure unique string in wiki doesn't show up
        docs = query('category:registration AND "{}"'.format(wiki_content['home']))['results']
        assert_equal(len(docs), 0)

        # Query and ensure registration does show up
        docs = query('category:registration AND ' + self.title)['results']
        assert_equal(len(docs), 1)
开发者ID:adlius,项目名称:osf.io,代码行数:33,代码来源:test_elastic_search.py

示例3: test_delete_project

    def test_delete_project(self):
        with run_celery_tasks():
            self.component.remove_node(self.consolidate_auth)
        docs = query('category:component AND ' + self.title)['results']
        assert_equal(len(docs), 0)

        with run_celery_tasks():
            self.project.remove_node(self.consolidate_auth)
        docs = query('category:project AND ' + self.title)['results']
        assert_equal(len(docs), 0)
开发者ID:adlius,项目名称:osf.io,代码行数:10,代码来源:test_elastic_search.py

示例4: test_hide_contributor

 def test_hide_contributor(self):
     user2 = factories.UserFactory(fullname='Brian May')
     self.project.add_contributor(user2)
     with run_celery_tasks():
         self.project.set_visible(user2, False, save=True)
     docs = query('category:project AND "{}"'.format(user2.fullname))['results']
     assert_equal(len(docs), 0)
     with run_celery_tasks():
         self.project.set_visible(user2, True, save=True)
     docs = query('category:project AND "{}"'.format(user2.fullname))['results']
     assert_equal(len(docs), 1)
开发者ID:adlius,项目名称:osf.io,代码行数:11,代码来源:test_elastic_search.py

示例5: test_make_private

    def test_make_private(self):
        # Make project public, then private, and verify that it is not present
        # in search.
        with run_celery_tasks():
            self.project.set_privacy('private')
        docs = query('category:project AND ' + self.title)['results']
        assert_equal(len(docs), 0)

        with run_celery_tasks():
            self.component.set_privacy('private')
        docs = query('category:component AND ' + self.title)['results']
        assert_equal(len(docs), 0)
开发者ID:adlius,项目名称:osf.io,代码行数:12,代码来源:test_elastic_search.py

示例6: test_make_public

 def test_make_public(self):
     # Make project public, and verify that it is present in Elastic
     # Search.
     with run_celery_tasks():
         self.project.set_privacy('public')
     docs = query(self.project.title)['results']
     assert_equal(len(docs), 1)
开发者ID:adlius,项目名称:osf.io,代码行数:7,代码来源:test_elastic_search.py

示例7: setUp

 def setUp(self):
     with run_celery_tasks():
         super(TestPublicNodes, self).setUp()
         self.user = factories.UserFactory(fullname='Doug Bogie')
         self.title = 'Red Special'
         self.consolidate_auth = Auth(user=self.user)
         self.project = factories.ProjectFactory(
             title=self.title,
             creator=self.user,
             is_public=True,
         )
         self.component = factories.NodeFactory(
             parent=self.project,
             title=self.title,
             creator=self.user,
             is_public=True
         )
         self.registration = factories.RegistrationFactory(
             title=self.title,
             creator=self.user,
             is_public=True,
         )
         self.registration.archive_job.target_addons = []
         self.registration.archive_job.status = 'SUCCESS'
         self.registration.archive_job.save()
开发者ID:adlius,项目名称:osf.io,代码行数:25,代码来源:test_elastic_search.py

示例8: test_public_parent_title

 def test_public_parent_title(self):
     self.project.set_title('hello & world', self.consolidate_auth)
     with run_celery_tasks():
         self.project.save()
     docs = query('category:component AND ' + self.title)['results']
     assert_equal(len(docs), 1)
     assert_equal(docs[0]['parent_title'], 'hello & world')
     assert_true(docs[0]['parent_url'])
开发者ID:adlius,项目名称:osf.io,代码行数:8,代码来源:test_elastic_search.py

示例9: test_make_parent_private

 def test_make_parent_private(self):
     # Make parent of component, public, then private, and verify that the
     # component still appears but doesn't link to the parent in search.
     with run_celery_tasks():
         self.project.set_privacy('private')
     docs = query('category:component AND ' + self.title)['results']
     assert_equal(len(docs), 1)
     assert_equal(docs[0]['parent_title'], '-- private project --')
     assert_false(docs[0]['parent_url'])
开发者ID:adlius,项目名称:osf.io,代码行数:9,代码来源:test_elastic_search.py

示例10: test_make_node_private

 def test_make_node_private(self):
     file_ = self.root.append_file('Change_Gonna_Come.wav')
     find = query_file('Change_Gonna_Come.wav')['results']
     assert_equal(len(find), 1)
     self.node.is_public = False
     with run_celery_tasks():
         self.node.save()
     find = query_file('Change_Gonna_Come.wav')['results']
     assert_equal(len(find), 0)
开发者ID:adlius,项目名称:osf.io,代码行数:9,代码来源:test_elastic_search.py

示例11: test_index_on_collection_privacy_changes

    def test_index_on_collection_privacy_changes(self):
        # test_submissions_of_collection_turned_private_are_removed_from_index
        docs = query_collections('Salif Keita')['results']
        assert_equal(len(docs), 0)

        self.collection_public.collect_object(self.node_one, self.user)
        self.collection_public.collect_object(self.node_two, self.user)
        self.collection_public.collect_object(self.node_public, self.user)
        self.reg_collection.collect_object(self.reg_public, self.user)

        docs = query_collections('Salif Keita')['results']
        assert_equal(len(docs), 4)

        with run_celery_tasks():
            self.collection_public.is_public = False
            self.collection_public.save()
            self.reg_collection.is_public = False
            self.reg_collection.save()

        docs = query_collections('Salif Keita')['results']
        assert_equal(len(docs), 0)

        # test_submissions_of_collection_turned_public_are_added_to_index
        self.collection_private.collect_object(self.node_one, self.user)
        self.collection_private.collect_object(self.node_two, self.user)
        self.collection_private.collect_object(self.node_public, self.user)
        self.reg_collection_private.collect_object(self.reg_public, self.user)

        assert_true(self.node_one.is_collected)
        assert_true(self.node_two.is_collected)
        assert_true(self.node_public.is_collected)
        assert_true(self.reg_public.is_collected)

        docs = query_collections('Salif Keita')['results']
        assert_equal(len(docs), 0)

        with run_celery_tasks():
            self.collection_private.is_public = True
            self.collection_private.save()
            self.reg_collection.is_public = True
            self.reg_collection.save()

        docs = query_collections('Salif Keita')['results']
        assert_equal(len(docs), 4)
开发者ID:erinspace,项目名称:osf.io,代码行数:44,代码来源:test_elastic_search.py

示例12: test_unreg_users_do_show_on_projects

 def test_unreg_users_do_show_on_projects(self):
     with run_celery_tasks():
         unreg = factories.UnregUserFactory(fullname='Robert Paulson')
         self.project = factories.ProjectFactory(
             title='Glamour Rock',
             creator=unreg,
             is_public=True,
         )
     results = query(unreg.fullname)['results']
     assert_equal(len(results), 1)
开发者ID:adlius,项目名称:osf.io,代码行数:10,代码来源:test_elastic_search.py

示例13: test_tag_aggregation

    def test_tag_aggregation(self):
        tags = ['stonecoldcrazy', 'just a poor boy', 'from-a-poor-family']

        with run_celery_tasks():
            for tag in tags:
                self.project.add_tag(tag, self.consolidate_auth, save=True)

        docs = query(self.title)['tags']
        assert len(docs) == 3
        for doc in docs:
            assert doc['key'] in tags
开发者ID:adlius,项目名称:osf.io,代码行数:11,代码来源:test_elastic_search.py

示例14: test_make_private_node_public

 def test_make_private_node_public(self):
     self.node.is_public = False
     self.node.save()
     file_ = self.root.append_file('Try a Little Tenderness.flac')
     find = query_file('Try a Little Tenderness.flac')['results']
     assert_equal(len(find), 0)
     self.node.is_public = True
     with run_celery_tasks():
         self.node.save()
     find = query_file('Try a Little Tenderness.flac')['results']
     assert_equal(len(find), 1)
开发者ID:adlius,项目名称:osf.io,代码行数:11,代码来源:test_elastic_search.py

示例15: test_add_contributor

    def test_add_contributor(self):
        # Add a contributor, then verify that project is found when searching
        # for contributor.
        user2 = factories.UserFactory(fullname='Adam Lambert')

        docs = query('category:project AND "{}"'.format(user2.fullname))['results']
        assert_equal(len(docs), 0)
        with run_celery_tasks():
            self.project.add_contributor(user2, save=True)

        docs = query('category:project AND "{}"'.format(user2.fullname))['results']
        assert_equal(len(docs), 1)
开发者ID:adlius,项目名称:osf.io,代码行数:12,代码来源:test_elastic_search.py


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