本文整理汇总了Python中tests.utils.helper_test_http_method_and_count函数的典型用法代码示例。如果您正苦于以下问题:Python helper_test_http_method_and_count函数的具体用法?Python helper_test_http_method_and_count怎么用?Python helper_test_http_method_and_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了helper_test_http_method_and_count函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_storage_list
def test_storage_list(client, data):
url = reverse("user-storage-list")
users = [None, data.user1, data.user2]
results = helper_test_http_method_and_count(client, "get", url, None, users)
assert results == [(200, 0), (200, 1), (200, 2)]
示例2: test_user_action_starred
def test_user_action_starred(client, data):
url1 = reverse('users-starred', kwargs={"pk": data.project_member_without_perms.pk})
url2 = reverse('users-starred', kwargs={"pk": data.project_member_with_perms.pk})
url3 = reverse('users-starred', kwargs={"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_and_count(client, 'get', url1, None, users)
assert results == [(200, 0), (200, 0), (200, 0), (200, 0), (200, 0)]
results = helper_test_http_method_and_count(client, 'get', url2, None, users)
assert results == [(200, 3), (200, 3), (200, 3), (200, 3), (200, 3)]
results = helper_test_http_method_and_count(client, 'get', url3, None, users)
assert results == [(200, 3), (200, 3), (200, 3), (200, 3), (200, 3)]
示例3: test_project_action_fans
def test_project_action_fans(client, data):
public_url = reverse('projects-fans', kwargs={"pk": data.public_project.pk})
private1_url = reverse('projects-fans', kwargs={"pk": data.private_project1.pk})
private2_url = reverse('projects-fans', kwargs={"pk": data.private_project2.pk})
users = [
None,
data.registered_user,
data.project_member_without_perms,
data.project_member_with_perms,
data.project_owner
]
results = helper_test_http_method_and_count(client, 'get', public_url, None, users)
assert results == [(200, 2), (200, 2), (200, 2), (200, 2), (200, 2)]
results = helper_test_http_method_and_count(client, 'get', private1_url, None, users)
assert results == [(200, 2), (200, 2), (200, 2), (200, 2), (200, 2)]
results = helper_test_http_method_and_count(client, 'get', private2_url, None, users)
assert results == [(404, 1), (404, 1), (404, 1), (200, 2), (200, 2)]
示例4: test_project_watchers_list
def test_project_watchers_list(client, data):
public_url = reverse('project-watchers-list', kwargs={"resource_id": data.public_project.pk})
private1_url = reverse('project-watchers-list', kwargs={"resource_id": data.private_project1.pk})
private2_url = reverse('project-watchers-list', kwargs={"resource_id": data.private_project2.pk})
users = [
None,
data.registered_user,
data.project_member_without_perms,
data.project_member_with_perms,
data.project_owner
]
results = helper_test_http_method_and_count(client, 'get', public_url, None, users)
assert results == [(200, 1), (200, 1), (200, 1), (200, 1), (200, 1)]
results = helper_test_http_method_and_count(client, 'get', private1_url, None, users)
assert results == [(200, 3), (200, 3), (200, 3), (200, 3), (200, 3)]
results = helper_test_http_method_and_count(client, 'get', private2_url, None, users)
assert results == [(401, 0), (403, 0), (403, 0), (200, 3), (200, 3)]
示例5: test_wiki_attachment_list
def test_wiki_attachment_list(client, data, data_wiki):
url = reverse('wiki-attachments-list')
users = [
None,
data.registered_user,
data.project_member_without_perms,
data.project_member_with_perms,
data.project_owner
]
results = helper_test_http_method_and_count(client, 'get', url, None, users)
assert results == [(200, 2), (200, 2), (200, 2), (200, 4), (200, 4)]
示例6: test_issue_attachment_list
def test_issue_attachment_list(client, data, data_issue):
url = reverse("issue-attachments-list")
users = [
None,
data.registered_user,
data.project_member_without_perms,
data.project_member_with_perms,
data.project_owner,
]
results = helper_test_http_method_and_count(client, "get", url, None, users)
assert results == [(200, 2), (200, 2), (200, 2), (200, 4), (200, 4)]