Skip to content
This repository was archived by the owner on Feb 5, 2026. It is now read-only.

Commit 47709a5

Browse files
authored
Merge pull request #238 from lihuacai168/fix-ci-redis-cli-error
feat: improve test coverage and remove unused files
2 parents dc31fc8 + 49f2fb7 commit 47709a5

27 files changed

Lines changed: 3611 additions & 384 deletions

.coverage

-68 KB
Binary file not shown.

.devcontainer/devcontainer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"ghcr.io/devcontainers/features/github-cli:1": {
88
"installDirectlyFromGitHubRelease": true,
99
"version": "latest"
10+
},
11+
"ghcr.io/devcontainers/features/sshd:1": {
12+
"version": "latest"
1013
}
1114
},
1215
"postCreateCommand": "bash .devcontainer/setup.sh",

FasterRunner/urls.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from rest_framework.routers import DefaultRouter
2222
from rest_framework_jwt.views import obtain_jwt_token
2323

24-
from fastrunner.views import run_all_auto_case
2524
from mock.views import MockAPILogViewSet, MockAPIView, MockAPIViewset, MockProjectViewSet
2625
from system import views as system_views
2726

@@ -68,7 +67,7 @@
6867
# 执行定时任务
6968
# TODO 需要增加触发检验,暂时关闭触发入口
7069
# re_path(r'^run_all_auto_case/$', run_all_auto_case.run_all_auto_case, name='run_all_auto_case'),
71-
path("get_report_url/", run_all_auto_case.get_report_url, name="get_report_url"),
70+
# path("get_report_url/", run_all_auto_case.get_report_url, name="get_report_url"),
7271
# swagger
7372
re_path(r"^swagger(?P<format>\.json|\.yaml)$", schema_view.without_ui(cache_timeout=0), name="schema-json"),
7473
path("swagger/", schema_view.with_ui("swagger", cache_timeout=0), name="schema-swagger-ui",),

ci_settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
SECRET_KEY = 'test-secret-key-for-ci-only'
1111
DEBUG = False
1212
ALLOWED_HOSTS = ['*']
13+
USE_LDAP = False
1314

1415
LOGGING = {
1516
'version': 1,
@@ -24,3 +25,4 @@
2425
'level': 'ERROR',
2526
},
2627
}
28+
EOF < /dev/null

conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import pytest
88
from django.conf import settings
99
from django.test.utils import get_runner
10+
from django.utils.crypto import get_random_string
1011

1112

1213
def pytest_configure(config):
@@ -44,7 +45,7 @@ def authenticated_user():
4445
user = MyUser.objects.create_user(
4546
username='testuser',
4647
email='test@example.com',
47-
password='testpass123'
48+
password=get_random_string(32)
4849
)
4950
return user
5051

fastrunner/test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# @Software: PyCharm
99

1010
from django.test import TestCase
11+
from django.utils.crypto import get_random_string
1112

1213
from fastuser import models
1314

@@ -21,7 +22,9 @@ def setUp(self):
2122
"email": "1@1.com"
2223
}
2324
"""
24-
models.UserInfo.objects.create(username="rikasai", password="mypassword", email="lihuacai168@gmail.com")
25+
models.UserInfo.objects.create(
26+
username="rikasai", password=get_random_string(32), email="lihuacai168@gmail.com"
27+
)
2528

2629
def test_user_register(self):
2730
res = models.UserInfo.objects.get(username="rikasai")

fastrunner/utils/response.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,31 @@ class StandResponse(ErrorMsg, GenericModel, Generic[GenericResultsType]):
3333

3434
SYSTEM_ERROR = {"code": "9999", "success": False, "msg": "System Error"}
3535

36+
VALIDATE_ERROR = {"code": "9998", "success": False, "msg": "参数校验错误"}
37+
38+
AUTH_FAIL = {"code": "9997", "success": False, "msg": "请登录"}
39+
40+
SYSTEM_SUCCESS = {"code": "0000", "success": True, "msg": "成功"}
41+
3642
TREE_ADD_SUCCESS = {"code": "0001", "success": True, "msg": "树形结构添加成功"}
3743

3844
TREE_UPDATE_SUCCESS = {"code": "0002", "success": True, "msg": "树形结构更新成功"}
3945

46+
TREE_DELETE_SUCCESS = {"code": "0003", "success": True, "msg": "树形结构删除成功"}
47+
48+
TREE_NOT_EXISTS = {"code": "0102", "success": False, "msg": "节点不存在"}
49+
4050
KEY_MISS = {"code": "0100", "success": False, "msg": "请求数据非法"}
4151

4252
FILE_UPLOAD_SUCCESS = {"code": "0001", "success": True, "msg": "文件上传成功"}
4353

4454
FILE_EXISTS = {"code": "0101", "success": False, "msg": "文件已存在,默认使用已有文件"}
55+
56+
FILE_UPLOAD_ERROR = {"code": "0103", "success": False, "msg": "文件上传失败"}
57+
58+
DEBUG_TALK_SUCCESS = {"code": "0001", "success": True, "msg": "Debugtalk更新成功"}
59+
60+
CASE_STEP_NOT_EXIST = {"code": "0104", "success": False, "msg": "用例步骤不存在"}
4561
YAPI_ADD_SUCCESS = {"code": "0001", "success": True, "msg": "导入YAPI接口添加成功"}
4662

4763
YAPI_ADD_FAILED = {"code": "0103", "success": False, "msg": "导入YAPI接口失败"}
@@ -60,8 +76,12 @@ class StandResponse(ErrorMsg, GenericModel, Generic[GenericResultsType]):
6076

6177
API_DEL_SUCCESS = {"code": "0003", "success": True, "msg": "API删除成功"}
6278

79+
API_DELETE_SUCCESS = {"code": "0003", "success": True, "msg": "API删除成功"}
80+
6381
REPORT_DEL_SUCCESS = {"code": "0003", "success": True, "msg": "报告删除成功"}
6482

83+
REPORT_DELETE_SUCCESS = {"code": "0003", "success": True, "msg": "报告删除成功"}
84+
6585
API_UPDATE_SUCCESS = {"code": "0002", "success": True, "msg": "API更新成功"}
6686

6787
SUITE_ADD_SUCCESS = {"code": "0001", "success": True, "msg": "Suite添加成功"}
@@ -101,8 +121,12 @@ class StandResponse(ErrorMsg, GenericModel, Generic[GenericResultsType]):
101121

102122
CONFIG_UPDATE_SUCCESS = {"code": "0002", "success": True, "msg": "环境更新成功"}
103123

124+
CONFIG_DELETE_SUCCESS = {"code": "0003", "success": True, "msg": "环境删除成功"}
125+
104126
VARIABLES_UPDATE_SUCCESS = {"code": "0002", "success": True, "msg": "全局变量更新成功"}
105127

128+
VARIABLES_DELETE_SUCCESS = {"code": "0003", "success": True, "msg": "全局变量删除成功"}
129+
106130
TASK_ADD_SUCCESS = {"code": "0001", "success": True, "msg": "定时任务新增成功"}
107131

108132
TASK_UPDATE_SUCCESS = {"code": "0002", "success": True, "msg": "定时任务更新成功"}
@@ -127,6 +151,18 @@ class StandResponse(ErrorMsg, GenericModel, Generic[GenericResultsType]):
127151

128152
TASK_RUN_SUCCESS = {"code": "0001", "success": True, "msg": "用例运行中,请稍后查看报告"}
129153

154+
TASK_NOT_EXIST = {"code": "0005", "success": False, "msg": "任务不存在"}
155+
156+
TASK_HAS_RUN = {"code": "0006", "success": False, "msg": "任务正在运行中"}
157+
158+
SCHEDULE_ADD_SUCCESS = {"code": "0001", "success": True, "msg": "调度添加成功"}
159+
160+
SCHEDULE_UPDATE_SUCCESS = {"code": "0002", "success": True, "msg": "调度更新成功"}
161+
162+
SCHEDULE_DELETE_SUCCESS = {"code": "0003", "success": True, "msg": "调度删除成功"}
163+
164+
SCHEDULE_NOT_EXISTS = {"code": "0102", "success": False, "msg": "调度不存在"}
165+
130166

131167
PLAN_DEL_SUCCESS = {"code": "0003", "success": True, "msg": "集成计划删除成功"}
132168

@@ -147,4 +183,13 @@ class StandResponse(ErrorMsg, GenericModel, Generic[GenericResultsType]):
147183
HOSTIP_EXISTS = {"code": "0101", "success": False, "msg": "此域名已存在,请重新命名"}
148184

149185
HOSTIP_UPDATE_SUCCESS = {"code": "0002", "success": True, "msg": "域名更新成功"}
186+
187+
HOST_ADD_SUCCESS = {"code": "0001", "success": True, "msg": "主机添加成功"}
188+
189+
HOST_UPDATE_SUCCESS = {"code": "0002", "success": True, "msg": "主机更新成功"}
190+
191+
HOST_DELETE_SUCCESS = {"code": "0003", "success": True, "msg": "主机删除成功"}
192+
193+
HOST_NOT_EXISTS = {"code": "0102", "success": False, "msg": "主机不存在"}
194+
150195
HOST_DEL_SUCCESS = {"code": "0003", "success": True, "msg": "域名删除成功"}

0 commit comments

Comments
 (0)