本文整理汇总了Python中taiga.timeline.service._add_to_object_timeline函数的典型用法代码示例。如果您正苦于以下问题:Python _add_to_object_timeline函数的具体用法?Python _add_to_object_timeline怎么用?Python _add_to_object_timeline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_add_to_object_timeline函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_filter_timeline_no_privileges
def test_filter_timeline_no_privileges():
Timeline.objects.all().delete()
user1 = factories.UserFactory()
user2 = factories.UserFactory()
task1= factories.TaskFactory()
service.register_timeline_implementation("tasks.task", "test", lambda x, extra_data=None: str(id(x)))
service._add_to_object_timeline(user1, task1, "test", task1.created_date)
timeline = Timeline.objects.exclude(event_type="users.user.create")
timeline = service.filter_timeline_for_user(timeline, user2)
assert timeline.count() == 0
开发者ID:cubettech,项目名称:taiga-back,代码行数:11,代码来源:test_timeline.py
示例2: test_add_to_object_timeline
def test_add_to_object_timeline():
Timeline.objects.all().delete()
user1 = factories.UserFactory()
task = factories.TaskFactory()
service.register_timeline_implementation("tasks.task", "test", lambda x, extra_data=None: str(id(x)))
service._add_to_object_timeline(user1, task, "test", task.created_date)
assert Timeline.objects.filter(object_id=user1.id).count() == 2
assert Timeline.objects.order_by("-id")[0].data == id(task)
开发者ID:cubettech,项目名称:taiga-back,代码行数:11,代码来源:test_timeline.py
示例3: test_add_to_object_timeline
def test_add_to_object_timeline():
Timeline.objects.all().delete()
user1 = factories.UserFactory()
user2 = factories.UserFactory()
service.register_timeline_implementation("users.user", "test", lambda x, extra_data=None: str(id(x)))
service._add_to_object_timeline(user1, user2, "test")
assert Timeline.objects.filter(object_id=user1.id).count() == 1
assert Timeline.objects.order_by("-id")[0].data == id(user2)
开发者ID:FlorianBezagu,项目名称:taiga-back,代码行数:11,代码来源:test_timeline.py
示例4: test_filter_timeline_private_project_anon_permissions
def test_filter_timeline_private_project_anon_permissions():
Timeline.objects.all().delete()
user1 = factories.UserFactory()
user2 = factories.UserFactory()
project = factories.ProjectFactory.create(is_private=True, anon_permissions= ["view_tasks"])
task1= factories.TaskFactory()
task2= factories.TaskFactory.create(project=project)
service.register_timeline_implementation("tasks.task", "test", lambda x, extra_data=None: str(id(x)))
service._add_to_object_timeline(user1, task1, "test", task1.created_date)
service._add_to_object_timeline(user1, task2, "test", task2.created_date)
timeline = Timeline.objects.exclude(event_type="users.user.create")
timeline = service.filter_timeline_for_user(timeline, user2)
assert timeline.count() == 1
开发者ID:cubettech,项目名称:taiga-back,代码行数:14,代码来源:test_timeline.py
示例5: test_filter_timeline_public_project
def test_filter_timeline_public_project():
Timeline.objects.all().delete()
user1 = factories.UserFactory()
user2 = factories.UserFactory()
project = factories.ProjectFactory.create(is_private=False)
task1= factories.TaskFactory()
task2= factories.TaskFactory.create(project=project)
service.register_timeline_implementation("tasks.task", "test", lambda x, extra_data=None: str(id(x)))
service._add_to_object_timeline(user1, task1, "test")
service._add_to_object_timeline(user1, task2, "test")
timeline = Timeline.objects.all()
timeline = service.filter_timeline_for_user(timeline, user2)
assert timeline.count() == 1
开发者ID:SashaBorandi,项目名称:taiga-back,代码行数:14,代码来源:test_timeline.py
示例6: test_filter_timeline_private_project_member_admin
def test_filter_timeline_private_project_member_admin():
Timeline.objects.all().delete()
user1 = factories.UserFactory()
user2 = factories.UserFactory()
project = factories.ProjectFactory.create(is_private=True)
membership = factories.MembershipFactory.create(user=user2, project=project, is_admin=True)
task1= factories.TaskFactory()
task2= factories.TaskFactory.create(project=project)
service.register_timeline_implementation("tasks.task", "test", lambda x, extra_data=None: id(x))
service._add_to_object_timeline(user1, task1, "test", task1.created_date)
service._add_to_object_timeline(user1, task2, "test", task2.created_date)
timeline = Timeline.objects.exclude(event_type="users.user.create")
timeline = service.filter_timeline_for_user(timeline, user2)
assert timeline.count() == 3
开发者ID:taigaio,项目名称:taiga-back,代码行数:15,代码来源:test_timeline.py
示例7: test_filter_timeline_private_project_member_permissions
def test_filter_timeline_private_project_member_permissions():
Timeline.objects.all().delete()
user1 = factories.UserFactory()
user2 = factories.UserFactory()
project = factories.ProjectFactory.create(is_private=True)
membership = factories.MembershipFactory.create(user=user2, project=project)
membership.role.permissions = ["view_tasks"]
membership.role.save()
task1= factories.TaskFactory()
task2= factories.TaskFactory.create(project=project)
service.register_timeline_implementation("tasks.task", "test", lambda x, extra_data=None: str(id(x)))
service._add_to_object_timeline(user1, task1, "test")
service._add_to_object_timeline(user1, task2, "test")
timeline = Timeline.objects.all()
timeline = service.filter_timeline_for_user(timeline, user2)
assert timeline.count() == 1
开发者ID:SashaBorandi,项目名称:taiga-back,代码行数:17,代码来源:test_timeline.py
示例8: test_get_timeline
def test_get_timeline():
Timeline.objects.all().delete()
user1 = factories.UserFactory()
user2 = factories.UserFactory()
user3 = factories.UserFactory()
user4 = factories.UserFactory()
service.register_timeline_implementation("users.user", "test", lambda x, extra_data=None: str(id(x)))
service._add_to_object_timeline(user1, user1, "test")
service._add_to_object_timeline(user1, user2, "test")
service._add_to_object_timeline(user1, user3, "test")
service._add_to_object_timeline(user1, user4, "test")
service._add_to_object_timeline(user2, user1, "test")
assert service.get_timeline(user1).count() == 4
assert service.get_timeline(user2).count() == 1
assert service.get_timeline(user3).count() == 0
开发者ID:FlorianBezagu,项目名称:taiga-back,代码行数:20,代码来源:test_timeline.py
示例9: test_get_timeline
def test_get_timeline():
Timeline.objects.all().delete()
user1 = factories.UserFactory()
user2 = factories.UserFactory()
user3 = factories.UserFactory()
task1= factories.TaskFactory()
task2= factories.TaskFactory()
task3= factories.TaskFactory()
task4= factories.TaskFactory()
service.register_timeline_implementation("tasks.task", "test", lambda x, extra_data=None: str(id(x)))
service._add_to_object_timeline(user1, task1, "test", task1.created_date)
service._add_to_object_timeline(user1, task2, "test", task2.created_date)
service._add_to_object_timeline(user1, task3, "test", task3.created_date)
service._add_to_object_timeline(user1, task4, "test", task4.created_date)
service._add_to_object_timeline(user2, task1, "test", task1.created_date)
assert Timeline.objects.filter(object_id=user1.id).count() == 5
assert Timeline.objects.filter(object_id=user2.id).count() == 2
assert Timeline.objects.filter(object_id=user3.id).count() == 1
开发者ID:cubettech,项目名称:taiga-back,代码行数:22,代码来源:test_timeline.py
注:本文中的taiga.timeline.service._add_to_object_timeline函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论