本文整理汇总了Python中tracim.model.DBSession.refresh方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.refresh方法的具体用法?Python DBSession.refresh怎么用?Python DBSession.refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracim.model.DBSession
的用法示例。
在下文中一共展示了DBSession.refresh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_mark_read__all
# 需要导入模块: from tracim.model import DBSession [as 别名]
# 或者: from tracim.model.DBSession import refresh [as 别名]
def test_mark_read__all(self):
uapi = UserApi(None)
groups = [GroupApi(None).get_one(Group.TIM_USER),
GroupApi(None).get_one(Group.TIM_MANAGER),
GroupApi(None).get_one(Group.TIM_ADMIN)]
user_a = uapi.create_user(email='[email protected]',
groups=groups, save_now=True)
user_b = uapi.create_user(email='[email protected]',
groups=groups, save_now=True)
wapi = WorkspaceApi(user_a)
workspace = wapi.create_workspace(
'test workspace',
save_now=True)
role_api = RoleApi(user_a)
role_api.create_one(user_b, workspace, UserRoleInWorkspace.READER, False)
cont_api_a = ContentApi(user_a)
cont_api_b = ContentApi(user_b)
page_2 = cont_api_a.create(ContentType.Page, workspace, None, 'this is page1', do_save=True)
page_3 = cont_api_a.create(ContentType.Thread, workspace, None, 'this is page2', do_save=True)
page_4 = cont_api_a.create(ContentType.File, workspace, None, 'this is page3', do_save=True)
for rev in page_2.revisions:
eq_(user_b not in rev.read_by.keys(), True)
for rev in page_3.revisions:
eq_(user_b not in rev.read_by.keys(), True)
for rev in page_4.revisions:
eq_(user_b not in rev.read_by.keys(), True)
DBSession.refresh(page_2)
DBSession.refresh(page_3)
DBSession.refresh(page_4)
cont_api_b.mark_read__all()
for rev in page_2.revisions:
eq_(user_b in rev.read_by.keys(), True)
for rev in page_3.revisions:
eq_(user_b in rev.read_by.keys(), True)
for rev in page_4.revisions:
eq_(user_b in rev.read_by.keys(), True)