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

Python utils.helper_test_http_method函数代码示例

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

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



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

示例1: test_wiki_action_edit_comment

def test_wiki_action_edit_comment(client, data, data_wiki):
    public_url = "{}?id={}".format(
        reverse('wiki-history-edit-comment', kwargs={"pk": data_wiki.public_wiki.pk}),
        data_wiki.public_history_entry.id
    )
    private_url1 = "{}?id={}".format(
        reverse('wiki-history-edit-comment', kwargs={"pk": data_wiki.private_wiki1.pk}),
        data_wiki.private_history_entry1.id
    )
    private_url2 = "{}?id={}".format(
        reverse('wiki-history-edit-comment', kwargs={"pk": data_wiki.private_wiki2.pk}),
        data_wiki.private_history_entry2.id
    )

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    data = json.dumps({"comment": "testing update comment"})

    results = helper_test_http_method(client, 'post', public_url, data, users)
    assert results == [401, 403, 403, 200, 200]
    results = helper_test_http_method(client, 'post', private_url1, data, users)
    assert results == [401, 403, 403, 200, 200]
    results = helper_test_http_method(client, 'post', private_url2, data, users)
    assert results == [401, 403, 403, 200, 200]
开发者ID:CrypticGator,项目名称:taiga-back,代码行数:30,代码来源:test_history_resources.py


示例2: test_milestone_update

def test_milestone_update(client, data):
    public_url = reverse('milestones-detail', kwargs={"pk": data.public_milestone.pk})
    private_url1 = reverse('milestones-detail', kwargs={"pk": data.private_milestone1.pk})
    private_url2 = reverse('milestones-detail', kwargs={"pk": data.private_milestone2.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    milestone_data = MilestoneSerializer(data.public_milestone).data
    milestone_data["name"] = "test"
    milestone_data = json.dumps(milestone_data)
    results = helper_test_http_method(client, 'put', public_url, milestone_data, users)
    assert results == [401, 403, 403, 200, 200]

    milestone_data = MilestoneSerializer(data.private_milestone1).data
    milestone_data["name"] = "test"
    milestone_data = json.dumps(milestone_data)
    results = helper_test_http_method(client, 'put', private_url1, milestone_data, users)
    assert results == [401, 403, 403, 200, 200]

    milestone_data = MilestoneSerializer(data.private_milestone2).data
    milestone_data["name"] = "test"
    milestone_data = json.dumps(milestone_data)
    results = helper_test_http_method(client, 'put', private_url2, milestone_data, users)
    assert results == [401, 403, 403, 200, 200]
开发者ID:6ft,项目名称:taiga-back,代码行数:30,代码来源:test_milestones_resources.py


示例3: test_wiki_link_create

def test_wiki_link_create(client, data):
    url = reverse('wiki-links-list')

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    create_data = json.dumps({
        "title": "test",
        "href": "test",
        "project": data.public_project.pk,
    })
    results = helper_test_http_method(client, 'post', url, create_data, users, lambda: WikiLink.objects.all().delete())
    assert results == [401, 201, 201, 201, 201]

    create_data = json.dumps({
        "title": "test",
        "href": "test",
        "project": data.private_project1.pk,
    })
    results = helper_test_http_method(client, 'post', url, create_data, users, lambda: WikiLink.objects.all().delete())
    assert results == [401, 201, 201, 201, 201]

    create_data = json.dumps({
        "title": "test",
        "href": "test",
        "project": data.private_project2.pk,
    })
    results = helper_test_http_method(client, 'post', url, create_data, users, lambda: WikiLink.objects.all().delete())
    assert results == [401, 403, 403, 201, 201]
开发者ID:FlorianBezagu,项目名称:taiga-back,代码行数:34,代码来源:test_wiki_resources.py


示例4: test_webhook_create

def test_webhook_create(client, data):
    url = reverse('webhooks-list')

    users = [
        None,
        data.registered_user,
        data.project_owner
    ]

    create_data = json.dumps({
        "name": "Test",
        "url": "http://test.com",
        "key": "test",
        "project": data.project1.pk,
    })
    results = helper_test_http_method(client, 'post', url, create_data, users, lambda: Webhook.objects.all().delete())
    assert results == [401, 403, 201]

    create_data = json.dumps({
        "name": "Test",
        "url": "http://test.com",
        "key": "test",
        "project": data.project2.pk,
    })
    results = helper_test_http_method(client, 'post', url, create_data, users, lambda: Webhook.objects.all().delete())
    assert results == [401, 403, 403]

    create_data = json.dumps({
        "name": "Test",
        "url": "http://test.com",
        "key": "test",
        "project": data.blocked_project.pk,
    })
    results = helper_test_http_method(client, 'post', url, create_data, users, lambda: Webhook.objects.all().delete())
    assert results == [401, 403, 451]
开发者ID:shreeshreee,项目名称:taiga-back,代码行数:35,代码来源:test_webhooks_resources.py


示例5: test_project_watchers_retrieve

def test_project_watchers_retrieve(client, data):
    public_url = reverse('project-watchers-detail', kwargs={"resource_id": data.public_project.pk,
                                                      "pk": data.project_owner.pk})
    private1_url = reverse('project-watchers-detail', kwargs={"resource_id": data.private_project1.pk,
                                                      "pk": data.project_owner.pk})
    private2_url = reverse('project-watchers-detail', kwargs={"resource_id": data.private_project2.pk,
                                                      "pk": data.project_owner.pk})
    blocked_url = reverse('project-watchers-detail', kwargs={"resource_id": data.blocked_project.pk,
                                                      "pk": data.project_owner.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    results = helper_test_http_method(client, 'get', public_url, None, users)
    assert results == [200, 200, 200, 200, 200]
    results = helper_test_http_method(client, 'get', private1_url, None, users)
    assert results == [200, 200, 200, 200, 200]
    results = helper_test_http_method(client, 'get', private2_url, None, users)
    assert results == [401, 403, 403, 200, 200]
    results = helper_test_http_method(client, 'get', blocked_url, None, users)
    assert results == [401, 403, 403, 200, 200]
开发者ID:SKOx0,项目名称:taiga-back,代码行数:26,代码来源:test_projects_resource.py


示例6: test_user_story_patch_comment

def test_user_story_patch_comment(client, data):
    public_url = reverse('userstories-detail', kwargs={"pk": data.public_user_story.pk})
    private_url1 = reverse('userstories-detail', kwargs={"pk": data.private_user_story1.pk})
    private_url2 = reverse('userstories-detail', kwargs={"pk": data.private_user_story2.pk})
    blocked_url = reverse('userstories-detail', kwargs={"pk": data.blocked_user_story.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    with mock.patch.object(OCCResourceMixin, "_validate_and_update_version"):
        patch_data = json.dumps({"comment": "test comment", "version": data.public_user_story.version})
        results = helper_test_http_method(client, 'patch', public_url, patch_data, users)
        assert results == [401, 403, 403, 200, 200]

        patch_data = json.dumps({"comment": "test comment", "version": data.private_user_story1.version})
        results = helper_test_http_method(client, 'patch', private_url1, patch_data, users)
        assert results == [401, 403, 403, 200, 200]

        patch_data = json.dumps({"comment": "test comment", "version": data.private_user_story2.version})
        results = helper_test_http_method(client, 'patch', private_url2, patch_data, users)
        assert results == [401, 403, 403, 200, 200]

        patch_data = json.dumps({"comment": "test comment", "version": data.blocked_user_story.version})
        results = helper_test_http_method(client, 'patch', blocked_url, patch_data, users)
        assert results == [401, 403, 403, 451, 451]
开发者ID:CrypticGator,项目名称:taiga-back,代码行数:30,代码来源:test_userstories_resources.py


示例7: test_userstory_watchers_retrieve

def test_userstory_watchers_retrieve(client, data):
    add_watcher(data.public_user_story, data.project_owner)
    public_url = reverse('userstory-watchers-detail', kwargs={"resource_id": data.public_user_story.pk,
                                                            "pk": data.project_owner.pk})
    add_watcher(data.private_user_story1, data.project_owner)
    private_url1 = reverse('userstory-watchers-detail', kwargs={"resource_id": data.private_user_story1.pk,
                                                              "pk": data.project_owner.pk})
    add_watcher(data.private_user_story2, data.project_owner)
    private_url2 = reverse('userstory-watchers-detail', kwargs={"resource_id": data.private_user_story2.pk,
                                                              "pk": data.project_owner.pk})
    add_watcher(data.blocked_user_story, data.project_owner)
    blocked_url = reverse('userstory-watchers-detail', kwargs={"resource_id": data.blocked_user_story.pk,
                                                              "pk": data.project_owner.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    results = helper_test_http_method(client, 'get', public_url, None, users)
    assert results == [200, 200, 200, 200, 200]
    results = helper_test_http_method(client, 'get', private_url1, None, users)
    assert results == [200, 200, 200, 200, 200]
    results = helper_test_http_method(client, 'get', private_url2, None, users)
    assert results == [401, 403, 403, 200, 200]
    results = helper_test_http_method(client, 'get', blocked_url, None, users)
    assert results == [401, 403, 403, 200, 200]
开发者ID:CrypticGator,项目名称:taiga-back,代码行数:30,代码来源:test_userstories_resources.py


示例8: test_userstory_custom_attribute_update

def test_userstory_custom_attribute_update(client, data):
    public_url = reverse('userstory-custom-attributes-detail', kwargs={"pk": data.public_userstory_ca.pk})
    private1_url = reverse('userstory-custom-attributes-detail', kwargs={"pk": data.private_userstory_ca1.pk})
    private2_url = reverse('userstory-custom-attributes-detail', kwargs={"pk": data.private_userstory_ca2.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    userstory_ca_data = serializers.UserStoryCustomAttributeSerializer(data.public_userstory_ca).data
    userstory_ca_data["name"] = "test"
    userstory_ca_data = json.dumps(userstory_ca_data)
    results = helper_test_http_method(client, 'put', public_url, userstory_ca_data, users)
    assert results == [401, 403, 403, 403, 200]

    userstory_ca_data = serializers.UserStoryCustomAttributeSerializer(data.private_userstory_ca1).data
    userstory_ca_data["name"] = "test"
    userstory_ca_data = json.dumps(userstory_ca_data)
    results = helper_test_http_method(client, 'put', private1_url, userstory_ca_data, users)
    assert results == [401, 403, 403, 403, 200]

    userstory_ca_data = serializers.UserStoryCustomAttributeSerializer(data.private_userstory_ca2).data
    userstory_ca_data["name"] = "test"
    userstory_ca_data = json.dumps(userstory_ca_data)
    results = helper_test_http_method(client, 'put', private2_url, userstory_ca_data, users)
    assert results == [401, 403, 403, 403, 200]
开发者ID:cubettech,项目名称:taiga-back,代码行数:30,代码来源:test_userstories_custom_attributes_resource.py


示例9: test_userstory_custom_attribute_action_bulk_update_order

def test_userstory_custom_attribute_action_bulk_update_order(client, data):
    url = reverse('userstory-custom-attributes-bulk-update-order')

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    post_data = json.dumps({
        "bulk_userstory_custom_attributes": [(1,2)],
        "project": data.public_project.pk
    })
    results = helper_test_http_method(client, 'post', url, post_data, users)
    assert results == [401, 403, 403, 403, 204]

    post_data = json.dumps({
        "bulk_userstory_custom_attributes": [(1,2)],
        "project": data.private_project1.pk
    })
    results = helper_test_http_method(client, 'post', url, post_data, users)
    assert results == [401, 403, 403, 403, 204]

    post_data = json.dumps({
        "bulk_userstory_custom_attributes": [(1,2)],
        "project": data.private_project2.pk
    })
    results = helper_test_http_method(client, 'post', url, post_data, users)
    assert results == [401, 403, 403, 403, 204]
开发者ID:cubettech,项目名称:taiga-back,代码行数:31,代码来源:test_userstories_custom_attributes_resource.py


示例10: test_userstory_custom_attributes_values_retrieve

def test_userstory_custom_attributes_values_retrieve(client, data):
    public_url = reverse('userstory-custom-attributes-values-detail', kwargs={
                                    "user_story_id": data.public_user_story.pk})
    private_url1 = reverse('userstory-custom-attributes-values-detail', kwargs={
                                    "user_story_id": data.private_user_story1.pk})
    private_url2 = reverse('userstory-custom-attributes-values-detail', kwargs={
                                    "user_story_id": data.private_user_story2.pk})
    blocked_url = reverse('userstory-custom-attributes-values-detail', kwargs={
                                    "user_story_id": data.blocked_user_story.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    results = helper_test_http_method(client, 'get', public_url, None, users)
    assert results == [200, 200, 200, 200, 200]
    results = helper_test_http_method(client, 'get', private_url1, None, users)
    assert results == [200, 200, 200, 200, 200]
    results = helper_test_http_method(client, 'get', private_url2, None, users)
    assert results == [401, 403, 403, 200, 200]
    results = helper_test_http_method(client, 'get', blocked_url, None, users)
    assert results == [401, 403, 403, 200, 200]
开发者ID:a06kin,项目名称:taiga-back,代码行数:26,代码来源:test_userstories_custom_attributes_resource.py


示例11: test_userstory_custom_attribute_create

def test_userstory_custom_attribute_create(client, data):
    public_url = reverse('userstory-custom-attributes-list')
    private1_url = reverse('userstory-custom-attributes-list')
    private2_url = reverse('userstory-custom-attributes-list')

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    userstory_ca_data = {"name": "test-new", "project": data.public_project.id}
    userstory_ca_data = json.dumps(userstory_ca_data)
    results = helper_test_http_method(client, 'post', public_url, userstory_ca_data, users)
    assert results == [401, 403, 403, 403, 201]

    userstory_ca_data = {"name": "test-new", "project": data.private_project1.id}
    userstory_ca_data = json.dumps(userstory_ca_data)
    results = helper_test_http_method(client, 'post', private1_url, userstory_ca_data, users)
    assert results == [401, 403, 403, 403, 201]

    userstory_ca_data = {"name": "test-new", "project": data.private_project2.id}
    userstory_ca_data = json.dumps(userstory_ca_data)
    results = helper_test_http_method(client, 'post', private2_url, userstory_ca_data, users)
    assert results == [401, 403, 403, 403, 201]
开发者ID:cubettech,项目名称:taiga-back,代码行数:27,代码来源:test_userstories_custom_attributes_resource.py


示例12: test_task_custom_attributes_values_update

def test_task_custom_attributes_values_update(client, data):
    public_url = reverse('task-custom-attributes-values-detail', kwargs={"task_id": data.public_task.pk})
    private_url1 = reverse('task-custom-attributes-values-detail', kwargs={"task_id": data.private_task1.pk})
    private_url2 = reverse('task-custom-attributes-values-detail', kwargs={"task_id": data.private_task2.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    task_data = serializers.TaskCustomAttributesValuesSerializer(data.public_task_cav).data
    task_data["attributes_values"] = {str(data.public_task_ca.pk): "test"}
    task_data = json.dumps(task_data)
    results = helper_test_http_method(client, 'put', public_url, task_data, users)
    assert results == [401, 403, 403, 200, 200]

    task_data = serializers.TaskCustomAttributesValuesSerializer(data.private_task_cav1).data
    task_data["attributes_values"] = {str(data.private_task_ca1.pk): "test"}
    task_data = json.dumps(task_data)
    results = helper_test_http_method(client, 'put', private_url1, task_data, users)
    assert results == [401, 403, 403, 200, 200]

    task_data = serializers.TaskCustomAttributesValuesSerializer(data.private_task_cav2).data
    task_data["attributes_values"] = {str(data.private_task_ca2.pk): "test"}
    task_data = json.dumps(task_data)
    results = helper_test_http_method(client, 'put', private_url2, task_data, users)
    assert results == [401, 403, 403, 200, 200]
开发者ID:cubettech,项目名称:taiga-back,代码行数:30,代码来源:test_tasks_custom_attributes_resource.py


示例13: test_modules_patch

def test_modules_patch(client, data):
    public_url = reverse('projects-modules', kwargs={"pk": data.public_project.pk})
    private_url1 = reverse('projects-modules', kwargs={"pk": data.private_project1.pk})
    private_url2 = reverse('projects-modules', kwargs={"pk": data.private_project2.pk})
    blocked_url = reverse('projects-modules', kwargs={"pk": data.blocked_project.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    with mock.patch.object(OCCResourceMixin, "_validate_and_update_version"):
        patch_data = json.dumps({"att": "test"})
        results = helper_test_http_method(client, 'patch', public_url, patch_data, users)
        assert results == [401, 403, 403, 403, 204]

        patch_data = json.dumps({"att": "test"})
        results = helper_test_http_method(client, 'patch', private_url1, patch_data, users)
        assert results == [401, 403, 403, 403, 204]

        patch_data = json.dumps({"att": "test"})
        results = helper_test_http_method(client, 'patch', private_url2, patch_data, users)
        assert results == [404, 404, 404, 403, 204]

        patch_data = json.dumps({"att": "test"})
        results = helper_test_http_method(client, 'patch', blocked_url, patch_data, users)
        assert results == [404, 404, 404, 403, 451]
开发者ID:shreeshreee,项目名称:taiga-back,代码行数:30,代码来源:test_modules_resources.py


示例14: test_modules_update

def test_modules_update(client, data):
    public_url = reverse('projects-modules', kwargs={"pk": data.public_project.pk})
    private_url1 = reverse('projects-modules', kwargs={"pk": data.private_project1.pk})
    private_url2 = reverse('projects-modules', kwargs={"pk": data.private_project2.pk})
    blocked_url = reverse('projects-modules', kwargs={"pk": data.blocked_project.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    with mock.patch.object(OCCResourceMixin, "_validate_and_update_version"):
        results = helper_test_http_method(client, 'put', public_url, {"att": "test"}, users)
        assert results == [405, 405, 405, 405, 405]

        results = helper_test_http_method(client, 'put', private_url1, {"att": "test"}, users)
        assert results == [405, 405, 405, 405, 405]

        results = helper_test_http_method(client, 'put', private_url2, {"att": "test"}, users)
        assert results == [405, 405, 405, 405, 405]

        results = helper_test_http_method(client, 'put', blocked_url, {"att": "test"}, users)
        assert results == [405, 405, 405, 405, 405]
开发者ID:shreeshreee,项目名称:taiga-back,代码行数:26,代码来源:test_modules_resources.py


示例15: test_task_voters_retrieve

def test_task_voters_retrieve(client, data):
    add_vote(data.public_task, data.project_owner)
    public_url = reverse('task-voters-detail', kwargs={"resource_id": data.public_task.pk,
                                                        "pk": data.project_owner.pk})
    add_vote(data.private_task1, data.project_owner)
    private_url1 = reverse('task-voters-detail', kwargs={"resource_id": data.private_task1.pk,
                                                          "pk": data.project_owner.pk})
    add_vote(data.private_task2, data.project_owner)
    private_url2 = reverse('task-voters-detail', kwargs={"resource_id": data.private_task2.pk,
                                                          "pk": data.project_owner.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    results = helper_test_http_method(client, 'get', public_url, None, users)
    assert results == [200, 200, 200, 200, 200]
    results = helper_test_http_method(client, 'get', private_url1, None, users)
    assert results == [200, 200, 200, 200, 200]
    results = helper_test_http_method(client, 'get', private_url2, None, users)
    assert results == [401, 403, 403, 200, 200]
开发者ID:spetpet,项目名称:taiga-back,代码行数:25,代码来源:test_tasks_resources.py


示例16: test_userstory_custom_attributes_values_update

def test_userstory_custom_attributes_values_update(client, data):
    public_url = reverse('userstory-custom-attributes-values-detail', kwargs={
                                    "user_story_id": data.public_user_story.pk})
    private_url1 = reverse('userstory-custom-attributes-values-detail', kwargs={
                                    "user_story_id": data.private_user_story1.pk})
    private_url2 = reverse('userstory-custom-attributes-values-detail', kwargs={
                                    "user_story_id": data.private_user_story2.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    user_story_data = serializers.UserStoryCustomAttributesValuesSerializer(data.public_user_story_cav).data
    user_story_data["attributes_values"] = {str(data.public_userstory_ca.pk): "test"}
    user_story_data = json.dumps(user_story_data)
    results = helper_test_http_method(client, 'put', public_url, user_story_data, users)
    assert results == [401, 403, 403, 200, 200]

    user_story_data = serializers.UserStoryCustomAttributesValuesSerializer(data.private_user_story_cav1).data
    user_story_data["attributes_values"] = {str(data.private_userstory_ca1.pk): "test"}
    user_story_data = json.dumps(user_story_data)
    results = helper_test_http_method(client, 'put', private_url1, user_story_data, users)
    assert results == [401, 403, 403, 200, 200]

    user_story_data = serializers.UserStoryCustomAttributesValuesSerializer(data.private_user_story_cav2).data
    user_story_data["attributes_values"] = {str(data.private_userstory_ca2.pk): "test"}
    user_story_data = json.dumps(user_story_data)
    results = helper_test_http_method(client, 'put', private_url2, user_story_data, users)
    assert results == [401, 403, 403, 200, 200]
开发者ID:cubettech,项目名称:taiga-back,代码行数:33,代码来源:test_userstories_custom_attributes_resource.py


示例17: test_user_story_create

def test_user_story_create(client, data):
    url = reverse('userstories-list')

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    create_data = json.dumps({"subject": "test", "ref": 1, "project": data.public_project.pk})
    results = helper_test_http_method(client, 'post', url, create_data, users)
    assert results == [401, 403, 403, 201, 201]

    create_data = json.dumps({"subject": "test", "ref": 2, "project": data.private_project1.pk})
    results = helper_test_http_method(client, 'post', url, create_data, users)
    assert results == [401, 403, 403, 201, 201]

    create_data = json.dumps({"subject": "test", "ref": 3, "project": data.private_project2.pk})
    results = helper_test_http_method(client, 'post', url, create_data, users)
    assert results == [401, 403, 403, 201, 201]

    create_data = json.dumps({"subject": "test", "ref": 4, "project": data.blocked_project.pk})
    results = helper_test_http_method(client, 'post', url, create_data, users)
    assert results == [401, 403, 403, 451, 451]
开发者ID:CrypticGator,项目名称:taiga-back,代码行数:26,代码来源:test_userstories_resources.py


示例18: test_userstory_custom_attributes_values_patch

def test_userstory_custom_attributes_values_patch(client, data):
    public_url = reverse('userstory-custom-attributes-values-detail', kwargs={
                                    "user_story_id": data.public_user_story.pk})
    private_url1 = reverse('userstory-custom-attributes-values-detail', kwargs={
                                    "user_story_id": data.private_user_story1.pk})
    private_url2 = reverse('userstory-custom-attributes-values-detail', kwargs={
                                    "user_story_id": data.private_user_story2.pk})

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    patch_data = json.dumps({"attributes_values": {str(data.public_userstory_ca.pk): "test"},
                             "version": data.public_user_story.version})
    results = helper_test_http_method(client, 'patch', public_url, patch_data, users)
    assert results == [401, 403, 403, 200, 200]

    patch_data = json.dumps({"attributes_values": {str(data.private_userstory_ca1.pk): "test"},
                             "version": data.private_user_story1.version})
    results = helper_test_http_method(client, 'patch', private_url1, patch_data, users)
    assert results == [401, 403, 403, 200, 200]

    patch_data = json.dumps({"attributes_values": {str(data.private_userstory_ca2.pk): "test"},
                             "version": data.private_user_story2.version})
    results = helper_test_http_method(client, 'patch', private_url2, patch_data, users)
    assert results == [401, 403, 403, 200, 200]
开发者ID:cubettech,项目名称:taiga-back,代码行数:30,代码来源:test_userstories_custom_attributes_resource.py


示例19: test_user_story_action_bulk_create

def test_user_story_action_bulk_create(client, data):
    url = reverse('userstories-bulk-create')

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    bulk_data = json.dumps({"bulk_stories": "test1\ntest2", "project_id": data.public_user_story.project.pk})
    results = helper_test_http_method(client, 'post', url, bulk_data, users)
    assert results == [401, 403, 403, 200, 200]

    bulk_data = json.dumps({"bulk_stories": "test1\ntest2", "project_id": data.private_user_story1.project.pk})
    results = helper_test_http_method(client, 'post', url, bulk_data, users)
    assert results == [401, 403, 403, 200, 200]

    bulk_data = json.dumps({"bulk_stories": "test1\ntest2", "project_id": data.private_user_story2.project.pk})
    results = helper_test_http_method(client, 'post', url, bulk_data, users)
    assert results == [401, 403, 403, 200, 200]

    bulk_data = json.dumps({"bulk_stories": "test1\ntest2", "project_id": data.blocked_user_story.project.pk})
    results = helper_test_http_method(client, 'post', url, bulk_data, users)
    assert results == [401, 403, 403, 451, 451]
开发者ID:CrypticGator,项目名称:taiga-back,代码行数:26,代码来源:test_userstories_resources.py


示例20: test_tasks_csv

def test_tasks_csv(client, data):
    url = reverse('tasks-csv')
    csv_public_uuid = data.public_project.tasks_csv_uuid
    csv_private1_uuid = data.private_project1.tasks_csv_uuid
    csv_private2_uuid = data.private_project1.tasks_csv_uuid
    csv_blocked_uuid = data.blocked_project.tasks_csv_uuid

    users = [
        None,
        data.registered_user,
        data.project_member_without_perms,
        data.project_member_with_perms,
        data.project_owner
    ]

    results = helper_test_http_method(client, 'get', "{}?uuid={}".format(url, csv_public_uuid), None, users)
    assert results == [200, 200, 200, 200, 200]

    results = helper_test_http_method(client, 'get', "{}?uuid={}".format(url, csv_private1_uuid), None, users)
    assert results == [200, 200, 200, 200, 200]

    results = helper_test_http_method(client, 'get', "{}?uuid={}".format(url, csv_private2_uuid), None, users)
    assert results == [200, 200, 200, 200, 200]

    results = helper_test_http_method(client, 'get', "{}?uuid={}".format(url, csv_blocked_uuid), None, users)
    assert results == [200, 200, 200, 200, 200]
开发者ID:a06kin,项目名称:taiga-back,代码行数:26,代码来源:test_tasks_resources.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python utils.helper_test_http_method_and_count函数代码示例发布时间:2022-05-27
下一篇:
Python utils.get_redirect_location函数代码示例发布时间: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