• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python service.register_timeline_implementation函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_register_timeline_implementation

def test_register_timeline_implementation():
    test_func = lambda x: "test-func-result"
    service.register_timeline_implementation("timeline.timeline", "test", test_func)
    assert service._timeline_impl_map["timeline.timeline.test"](None) == "test-func-result"

    @service.register_timeline_implementation("timeline.timeline", "test-decorator")
    def decorated_test_function(x):
        return "test-decorated-func-result"

    assert service._timeline_impl_map["timeline.timeline.test-decorator"](None) == "test-decorated-func-result"
开发者ID:Sheshtawy,项目名称:taiga-back,代码行数:10,代码来源:test_timeline.py


示例2: 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


示例3: 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


示例4: 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


示例5: 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


示例6: 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


示例7: 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


示例8: 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


示例9: 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


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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python services.get_photo_or_gravatar_url函数代码示例发布时间:2022-05-27
下一篇:
Python service.get_project_timeline函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap