Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
backend_auto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
邓莹莹
backend_auto
Commits
7e46aaf2
Commit
7e46aaf2
authored
Apr 21, 2021
by
张淑琴
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'common_dev' into zsq_dev
parents
58da55f9
a78f445f
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
177 additions
and
16 deletions
+177
-16
yaml文件错误示范.png
.readme_images/yaml文件错误示范.png
+0
-0
account_request.yaml
all_backend_api/account_request.yaml
+1
-0
oneimage_request.py
all_backend_api/oneimage_request.py
+29
-0
oneimage_request.yaml
all_backend_api/oneimage_request.yaml
+18
-0
web2_request.py
all_doctor_api/web2_request.py
+3
-3
web2_request.yaml
all_doctor_api/web2_request.yaml
+3
-2
host.yaml
host.yaml
+1
-1
base_request.py
in_common/base_request.py
+8
-1
login_session_function.py
login_session_function.py
+12
-1
login_session_function.yaml
login_session_function.yaml
+10
-7
path_setting.py
path_setting.py
+26
-0
readme.md
readme.md
+6
-0
__init__.py
test_backend_case/oneimage_case/__init__.py
+0
-0
test_recomend_services.py
test_backend_case/oneimage_case/test_recomend_services.py
+19
-0
test_share_v4.py
test_backend_case/oneimage_case/test_share_v4.py
+24
-0
__init__.py
test_backend_data/oneimage_data/__init__.py
+0
-0
recomend_services.yaml
test_backend_data/oneimage_data/recomend_services.yaml
+8
-0
share_v4.yaml
test_backend_data/oneimage_data/share_v4.yaml
+8
-0
service_list.yaml
test_doctor_data/web2_data/service_list.yaml
+1
-1
No files found.
.readme_images/yaml文件错误示范.png
0 → 100644
View file @
7e46aaf2
47 KB
all_backend_api/account_request.yaml
View file @
7e46aaf2
...
...
@@ -9,5 +9,6 @@ login_vfc:
vfc_type
:
${vfc_type}
face_token
:
${face_token}
json
:
{}
isLogin
:
1
#需要登录添加这个字段,值为1 0是不需要登录的情况,如不需要登录,可以不添加这个字段
all_backend_api/oneimage_request.py
0 → 100644
View file @
7e46aaf2
import
path_setting
from
in_common.base_request
import
BaseRequest
class
oneimage_request
(
BaseRequest
):
def
__init__
(
self
):
self
.
data
=
self
.
api_load
(
path_setting
.
ONEIMAGE_SHARE_V4_CONFIG
)
# 测颜值结果页
def
share_v4
(
self
,
version
,
face_id
):
self
.
params
[
"version"
]
=
version
self
.
params
[
"face_id"
]
=
face_id
return
self
.
api_send
(
self
.
data
[
"share_v4"
])
# 测颜值结果页,根据五官推荐美购接口
def
recomend_services
(
self
,
version
,
business_tags_names
):
self
.
params
[
"version"
]
=
version
self
.
params
[
"business_tags_names"
]
=
business_tags_names
return
self
.
api_send
(
self
.
data
[
"recomend_services"
])
if
__name__
==
'__main__'
:
print
(
oneimage_request
()
.
share_v4
(
"7.42.2"
,
"27320150"
))
business_tags_names
=
'[[],[],["玻尿酸垫下巴","自体脂肪垫下巴","硅胶垫下巴","膨体垫下巴"],["半永久纹眉","植眉"],["玻尿酸丰唇","胶原蛋白填充丰唇","自体脂肪丰唇"],[],["开内眼角"],["射频提升","热拉提","热拉提plus","热玛吉","超声提升"],["热玛吉"],[],["注射瘦脸","激光溶脂瘦脸","取颊脂垫瘦脸","光纤溶脂瘦脸","下颌角整形"]]'
print
(
oneimage_request
()
.
recomend_services
(
"7.42.2"
,
business_tags_names
))
\ No newline at end of file
all_backend_api/oneimage_request.yaml
0 → 100644
View file @
7e46aaf2
#测肤结果页
share_v4
:
method
:
post
url
:
/api/one_image/share/v4
params
:
version
:
${version}
data
:
face_id
:
${face_id}
json
:
{}
#测肤结果根据五官推荐美购
recomend_services
:
method
:
get
url
:
/api/one_image/recomend/services
params
:
version
:
${version}
business_tags_names
:
${business_tags_names}
json
:
{}
all_doctor_api/web2_request.py
View file @
7e46aaf2
...
...
@@ -13,5 +13,5 @@ class web2_request(BaseRequest):
return
self
.
api_send
(
self
.
data
[
"service_list"
])
if
__name__
==
'__main__'
:
print
(
web2_request
()
.
service_list
(
"1"
,
"10"
,
"-1"
))
\ No newline at end of file
if
__name__
==
'__main__'
:
print
(
web2_request
()
.
service_list
(
"1"
,
"10"
,
"-1"
))
\ No newline at end of file
all_doctor_api/web2_request.yaml
View file @
7e46aaf2
...
...
@@ -6,4 +6,5 @@ service_list:
pagesize
:
${pagesize}
is_online
:
${is_online}
data
:
{}
json
:
{}
\ No newline at end of file
json
:
{}
isLogin
:
1
\ No newline at end of file
host.yaml
View file @
7e46aaf2
develop_host
:
backend
:
http://backend.paas-develop.env
# doctor: http://doctor.paas-develop.env
/
# doctor: http://doctor.paas-develop.env
in_common/base_request.py
View file @
7e46aaf2
...
...
@@ -62,6 +62,13 @@ class BaseRequest:
def
api_send
(
self
,
req
:
dict
):
host
=
self
.
api_load
(
path_setting
.
HOSTYAML_CONFIG
)
url_host
=
""
if
host
[
"develop_host"
]
.
get
(
"doctor"
)
==
"http://doctor.paas-develop.env"
:
url_host
=
host
[
'develop_host'
][
'doctor'
]
elif
host
[
"develop_host"
]
.
get
(
"backend"
)
==
"http://backend.paas-develop.env"
:
url_host
=
host
[
'develop_host'
][
'backend'
]
raw
=
yaml
.
dump
(
req
)
# 将一个python对象生成为yaml文档
for
key
,
value
in
self
.
params
.
items
():
raw
=
raw
.
replace
(
f
"${{{key}}}"
,
repr
(
value
))
...
...
@@ -75,7 +82,7 @@ class BaseRequest:
# 调用具体case的url
r
=
s
.
request
(
req
[
'method'
],
url
=
host
[
'develop_host'
][
'backend'
]
+
req
[
'url'
],
url
=
url_host
+
req
[
'url'
],
params
=
req
.
get
(
'params'
),
# headers=user_headers,
data
=
req
.
get
(
'data'
),
...
...
login_session_function.py
View file @
7e46aaf2
...
...
@@ -36,7 +36,18 @@ class LoginFunction:
return
s
def
get_doctor_session
(
self
):
pass
url
=
self
.
host
[
"develop_host"
][
"doctor"
]
+
self
.
params
[
"doctor_login"
][
"url"
]
s
=
requests
.
session
()
r
=
s
.
request
(
self
.
params
[
"doctor_login"
][
"method"
],
url
=
url
,
params
=
self
.
params
[
"doctor_login"
][
"params"
],
data
=
self
.
params
[
"doctor_login"
][
"data"
],
headers
=
{
'Connection'
:
'close'
}
)
return
s
...
...
login_session_function.yaml
View file @
7e46aaf2
...
...
@@ -9,11 +9,14 @@ backend_login:
vfc_type
:
face_token
:
#doctor_login:
# method: post
# url: /api
# params:
# a: "a"
# data:
# b: "b"
doctor_login
:
method
:
post
url
:
/api/web/account/login
params
:
{}
data
:
name
:
"
12345654321"
password
:
123456
method
:
password
csrfmiddlewaretoken
:
"
PKHywf6cMBZUkc5WfklO71bQNoMztAfv"
path_setting.py
View file @
7e46aaf2
...
...
@@ -12,6 +12,16 @@ DIARY_DATA_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "diar
DIARY_DATA
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/account_data"
,
"diary_data.yaml"
)
#搜索首页-热门搜索
KEYWORDS_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"search_request.yaml"
)
KEYWORDS
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/search_data"
,
"keywords.yaml"
)
SERVICE_DATA
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_doctor_data/web2_data"
,
"service_list.yaml"
)
SERVICE_URL
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_doctor_api"
,
"web2_request.yaml"
)
#搜索首页-热门搜索
KEYWORDS_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"search_request.yaml"
)
KEYWORDS
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/search_data"
,
"keywords.yaml"
)
...
...
@@ -20,9 +30,25 @@ SERVICE_DATA=os.path.join(BASE_DIR, "backend_auto/test_doctor_data/web2_data", "
SERVICE_URL
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_doctor_api"
,
"web2_request.yaml"
)
#搜索首页-热门搜索
KEYWORDS_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"search_request.yaml"
)
KEYWORDS
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/search_data"
,
"keywords.yaml"
)
SERVICE_DATA
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_doctor_data/web2_data"
,
"service_list.yaml"
)
SERVICE_URL
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_doctor_api"
,
"web2_request.yaml"
)
# 首页灰度v9,精选tab
FEED_INDEXV9_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"feed_request.yaml"
)
FEED_INDEXV9_DATA
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/feed_data"
,
"index_v9.yaml"
)
# 测颜值结果页
ONEIMAGE_SHARE_V4_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"oneimage_request.yaml"
)
ONEIMAGE_SHARE_V4_DATA
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/oneimage_data"
,
"share_v4.yaml"
)
# 测颜值根据五官推荐美购
ONEIMAGE_RECOMEND_SERVICES_DATA
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/oneimage_data"
,
"recomend_services.yaml"
)
LOGIN_PASSWD
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/accounts_data"
,
"login_passwd.yaml"
)
LOGIN_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"accounts_request.yaml"
)
...
...
readme.md
View file @
7e46aaf2
...
...
@@ -32,8 +32,14 @@
-
test_backend_data 文件主要放测试用例的case
-
host.yaml 维护测试环境的配置文件
-
path_setting.py 文件主要是配置yaml文件的读取路径
-
login_session_function.py 文件主要提供获取session的功能,方便需登录的接口获取session 2021-4-19新增
-
login_session_function.yaml login_session_function.py文件需要登录的数据 2021-4-19新增
-
run.py 统一执行入口
### 关于yaml文明书写的注意事项 2021-4-19新增
-
yaml文件对空格换行要求非常严格,所以书写时要特别注意

### 如何写一个用例
-
先在all_backend_api下找到对应的模块,比如我写节点account下面的接口,那就找到account_request.py这个文件,写接口请求
...
...
test_backend_case/oneimage_case/__init__.py
0 → 100644
View file @
7e46aaf2
test_backend_case/oneimage_case/test_recomend_services.py
0 → 100644
View file @
7e46aaf2
import
pytest
from
ids_list
import
get_ids
import
path_setting
from
in_common.base_request
import
BaseRequest
from
all_backend_api.oneimage_request
import
oneimage_request
# 测颜值根据五官推荐美购
class
TestRecomendServices
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
ONEIMAGE_RECOMEND_SERVICES_DATA
)
recomendservice_case
,
recomendservice_data
=
get_ids
(
data
,
"recomend_services"
)
@pytest.mark.skip
(
"跳过测颜值根据五官推荐美购,目前数据是参数是线上的-------------------"
)
@pytest.mark.parametrize
(
"param"
,
recomendservice_data
,
ids
=
recomendservice_case
)
def
test_recomend_services
(
self
,
param
):
r
=
oneimage_request
()
.
recomend_services
(
param
[
"version"
],
param
[
"business_tags_names"
])
assert
r
[
"error"
]
==
param
[
"assert"
]
test_backend_case/oneimage_case/test_share_v4.py
0 → 100644
View file @
7e46aaf2
import
pytest
from
ids_list
import
get_ids
import
path_setting
from
in_common.base_request
import
BaseRequest
from
all_backend_api.oneimage_request
import
oneimage_request
class
TestShareV4
:
"""
测颜值结果页,分享结果
"""
data
=
BaseRequest
()
.
api_load
(
path_setting
.
ONEIMAGE_SHARE_V4_DATA
)
sharev4_case
,
sharev4_data
=
get_ids
(
data
,
"share_v4"
)
@pytest.mark.skip
(
"跳过,测颜值结果v4,目前数据是线上的-------------------"
)
@pytest.mark.parametrize
(
"param"
,
sharev4_data
,
ids
=
sharev4_case
)
def
test_share_v4
(
self
,
param
):
r
=
oneimage_request
()
.
share_v4
(
param
[
"version"
],
param
[
"face_id"
])
if
r
[
"error"
]
==
0
:
data
=
r
.
get
(
"data"
)
assert
1
==
1
test_backend_data/oneimage_data/__init__.py
0 → 100644
View file @
7e46aaf2
test_backend_data/oneimage_data/recomend_services.yaml
0 → 100644
View file @
7e46aaf2
recomend_services
:
#成功登录case
-
case
:
"
请求成功,有数据返回"
version
:
"
7.42.2"
business_tags_names
:
'
[[],[],["玻尿酸垫下巴","自体脂肪垫下巴","硅胶垫下巴","膨体垫下巴"],["半永久纹眉","植眉"],["玻尿酸丰唇","胶原蛋白填充丰唇","自体脂肪丰唇"],[],["开内眼角"],["射频提升","热拉提","热拉提plus","热玛吉","超声提升"],["热玛吉"],[],["注射瘦脸","激光溶脂瘦脸","取颊脂垫瘦脸","光纤溶脂瘦脸","下颌角整形"]]'
assert
:
0
\ No newline at end of file
test_backend_data/oneimage_data/share_v4.yaml
0 → 100644
View file @
7e46aaf2
share_v4
:
#成功登录case
-
case
:
"
请求成功,有数据返回"
version
:
"
7.42.2"
face_id
:
"
27320150"
assert
:
0
\ No newline at end of file
test_doctor_data/web2_data/service_list.yaml
View file @
7e46aaf2
...
...
@@ -5,4 +5,4 @@ service_list:
page
:
"
1"
pagesize
:
"
10"
is_online
:
"
-1"
assert
:
"
1"
assert
:
1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment