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


Python CommentFactory.reload方法代码示例

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


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

示例1: test_update_wiki_updates_contributor_comments_viewed_timestamp

# 需要导入模块: from osf_tests.factories import CommentFactory [as 别名]
# 或者: from osf_tests.factories.CommentFactory import reload [as 别名]
    def test_update_wiki_updates_contributor_comments_viewed_timestamp(self):
        contributor = AuthUserFactory()
        project = ProjectFactory(creator=self.user, is_public=True)
        project.add_contributor(contributor)
        project.save()
        wiki_page = WikiFactory(node=project, page_name='test')
        wiki = WikiVersionFactory(wiki_page=wiki_page)
        comment = CommentFactory(node=project, target=Guid.load(wiki_page._id), user=self.user)

        # user views comments -- sets user.comments_viewed_timestamp
        url = project.api_url_for('update_comments_timestamp')
        res = self.app.put_json(url, {
            'page': 'wiki',
            'rootId': wiki_page._id
        }, auth=self.user.auth)
        assert res.status_code == 200
        self.user.reload()
        assert wiki_page._id in self.user.comments_viewed_timestamp

        # contributor views comments -- sets contributor.comments_viewed_timestamp
        res = self.app.put_json(url, {
            'page': 'wiki',
            'rootId': wiki_page._id
        }, auth=contributor.auth)
        contributor.reload()
        assert wiki_page._id in contributor.comments_viewed_timestamp

        # user updates the wiki
        project.update_node_wiki('test', 'Updating wiki', self.auth)
        comment.reload()
        contributor.reload()

        new_version_id = project.get_wiki_version('test')._id
        assert wiki_page._id in contributor.comments_viewed_timestamp
        assert comment.target.referent._id == wiki_page._id
开发者ID:erinspace,项目名称:osf.io,代码行数:37,代码来源:test_views.py

示例2: test_update_wiki_updates_comments_and_user_comments_viewed_timestamp

# 需要导入模块: from osf_tests.factories import CommentFactory [as 别名]
# 或者: from osf_tests.factories.CommentFactory import reload [as 别名]
    def test_update_wiki_updates_comments_and_user_comments_viewed_timestamp(self):
        project = ProjectFactory(creator=self.user, is_public=True)
        wiki_page = WikiFactory(node=project, page_name='test')
        wiki = WikiVersionFactory(wiki_page=wiki_page)
        comment = CommentFactory(node=project, target=Guid.load(wiki_page._id), user=UserFactory())

        # user views comments -- sets user.comments_viewed_timestamp
        url = project.api_url_for('update_comments_timestamp')
        res = self.app.put_json(url, {
            'page': 'wiki',
            'rootId': wiki_page._id
        }, auth=self.user.auth)
        assert res.status_code == 200
        self.user.reload()
        assert wiki_page._id in self.user.comments_viewed_timestamp

        # user updates the wiki
        wiki_page.update(self.user, 'Updating wiki')
        comment.reload()
        self.user.reload()
        assert wiki_page._id in self.user.comments_viewed_timestamp
        assert comment.target.referent._id == wiki_page._id
开发者ID:CenterForOpenScience,项目名称:osf.io,代码行数:24,代码来源:test_views.py


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