Delete test_pr_permission.py

This commit is contained in:
floraachy 2025-06-24 13:44:42 +08:00
parent 42b03ef2f7
commit 9d31476a61
1 changed files with 0 additions and 113 deletions

View File

@ -1,113 +0,0 @@
"""
@FileNametest_issue_permission.py.py
@Description
@AuthorFloraachy
@Time2024/11/22 13:46
"""
# 第三方库导入
import pytest
import allure
# 本地应用/模块导入
from settings import GITLINK_DIR,GLOBAL_VARS
from utils.requests_utils.request_control import RequestControl
@allure.epic("GitLink")
@allure.feature("权限测试")
@allure.story("合并请求PR")
@pytest.mark.flow
@allure.title("在私有仓库测试非仓库成员访问合并请求,访问报错")
def test_pr_permission_on_private_repo(gitlink_login):
"""
合并请求权限测试
"""
with allure.step("登录用户新建一个私有仓库"):
global_var = GLOBAL_VARS.copy()
global_var["user_id"] = GLOBAL_VARS["env_user_id"]
global_var["_cookies"] = GLOBAL_VARS["cookies"]
project_info = RequestControl().api_request_flow(api_file_path=GITLINK_DIR,
key="gitlink_projects_new_project_02",
global_var=global_var)
global_var["repo_owner"] = project_info["repo_owner"]
global_var["repo_identifier"] = project_info["repo_identifier"]
global_var["init_repo_owner"] = project_info["repo_owner"]
global_var["init_repo_identifier"] = project_info["repo_identifier"]
with allure.step("仓库拥有者,获取测试仓库的默认分支"):
res = RequestControl().api_request_flow(api_file_path=GITLINK_DIR, key="gitlink_get_repo_detail_full_01",
global_var=global_var)
global_var.update(res)
with allure.step("仓库拥有者代码库新建文件,提交的分支新分支"):
global_var["repo_file_path"] = "test_permission.py"
res = RequestControl().api_request_flow(api_file_path=GITLINK_DIR, key="gitlink_repo_create_files_05",
global_var=global_var)
global_var.update(res)
with allure.step("仓库拥有者,新建一个合并请求"):
issue_info = RequestControl().api_request_flow(api_file_path=GITLINK_DIR, key="gitlink_repo_new_pull_request_01",
global_var=global_var)
global_var.update(issue_info)
with allure.step("非项目成员登录"):
global_var["env_login"] = GLOBAL_VARS["t_login"]
global_var["env_password"] = GLOBAL_VARS["t_password"]
login_info = RequestControl().api_request_flow(api_file_path=GITLINK_DIR, key="gitlink_login_01",
global_var=global_var)
global_var["cookies"] = login_info["cookies"]
with allure.step("非项目成员,访问合并请求详情,应该报错"):
RequestControl().api_request_flow(api_file_path=GITLINK_DIR, key="gitlink_repo_get_pull_request_detail_02",
global_var=global_var)
with allure.step("仓库拥有者,删除仓库"):
global_var["cookies"] = global_var["_cookies"]
RequestControl().api_request_flow(api_file_path=GITLINK_DIR, key="gitlink_projects_delete_project_01",
global_var=global_var)
@allure.epic("GitLink")
@allure.feature("权限测试")
@allure.story("合并请求PR")
@pytest.mark.flow
@allure.title("在公有仓库测试非仓库成员访问合并请求的,访问成功")
def test_pr_permission_on_public_repo(gitlink_login):
"""
合并请求权限
"""
with allure.step("登录用户新建一个公开仓库"):
global_var = GLOBAL_VARS.copy()
global_var["user_id"] = GLOBAL_VARS["env_user_id"]
global_var["_cookies"] = GLOBAL_VARS["cookies"]
project_info = RequestControl().api_request_flow(api_file_path=GITLINK_DIR,
key="gitlink_projects_new_project_01",
global_var=global_var)
global_var["repo_owner"] = project_info["repo_owner"]
global_var["repo_identifier"] = project_info["repo_identifier"]
global_var["init_repo_owner"] = project_info["repo_owner"]
global_var["init_repo_identifier"] = project_info["repo_identifier"]
with allure.step("仓库拥有者,获取测试仓库的默认分支"):
res = RequestControl().api_request_flow(api_file_path=GITLINK_DIR, key="gitlink_get_repo_detail_full_01",
global_var=global_var)
global_var.update(res)
with allure.step("仓库拥有者,代码库新建文件,提交的分支新分支"):
global_var["repo_file_path"] = "test_permission.py"
res = RequestControl().api_request_flow(api_file_path=GITLINK_DIR, key="gitlink_repo_create_files_05",
global_var=global_var)
global_var.update(res)
with allure.step("仓库拥有者,新建一个合并请求"):
issue_info = RequestControl().api_request_flow(api_file_path=GITLINK_DIR,
key="gitlink_repo_new_pull_request_01",
global_var=global_var)
global_var.update(issue_info)
with allure.step("非项目成员登录"):
global_var["env_login"] = GLOBAL_VARS["t_login"]
global_var["env_password"] = GLOBAL_VARS["t_password"]
login_info = RequestControl().api_request_flow(api_file_path=GITLINK_DIR, key="gitlink_login_01",
global_var=global_var)
global_var["cookies"] = login_info["cookies"]
with allure.step("非项目成员,访问合并请求详情,访问成功"):
RequestControl().api_request_flow(api_file_path=GITLINK_DIR, key="gitlink_repo_get_pull_request_detail_01",
global_var=global_var)
with allure.step("仓库拥有者,删除仓库"):
global_var["cookies"] = global_var["_cookies"]
RequestControl().api_request_flow(api_file_path=GITLINK_DIR, key="gitlink_projects_delete_project_01",
global_var=global_var)