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
1f99b730
Commit
1f99b730
authored
Apr 15, 2021
by
Cornelius Edward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tijiao
parent
b55d8aad
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
105 additions
and
4 deletions
+105
-4
.DS_Store
.DS_Store
+0
-0
1111.txt
1111.txt
+0
-0
accounts_request.py
all_backend_api/accounts_request.py
+19
-0
accounts_request.yaml
all_backend_api/accounts_request.yaml
+10
-0
base_request.py
in_common/base_request.py
+2
-1
path_setting.py
path_setting.py
+2
-1
.DS_Store
test_backend_case/.DS_Store
+0
-0
test_login_passwd.py
test_backend_case/accounts_case/test_login_passwd.py
+21
-2
login_passwd.yaml
test_backend_data/accounts_data/login_passwd.yaml
+51
-0
No files found.
.DS_Store
0 → 100644
View file @
1f99b730
File added
1111.txt
deleted
100644 → 0
View file @
b55d8aad
all_backend_api/accounts_request.py
View file @
1f99b730
import
path_setting
from
in_common.base_request
import
BaseRequest
import
pytest
class
send_reqest
(
BaseRequest
):
def
__init__
(
self
):
self
.
data
=
self
.
api_load
(
path_setting
.
LOGIN_CONFIG
)
print
(
self
.
data
)
def
login_passwd
(
self
,
current_city_id
,
phone
,
password
,
face_token
=
""
):
self
.
params
[
"current_city_id"
]
=
current_city_id
self
.
params
[
"phone"
]
=
phone
self
.
params
[
"password"
]
=
password
self
.
params
[
"face_token"
]
=
face_token
return
self
.
api_send
(
self
.
data
[
"password"
])
if
__name__
==
'__main__'
:
print
(
send_reqest
()
.
login_passwd
(
"beijing"
,
"17796839512"
,
123456
,
""
))
all_backend_api/accounts_request.yaml
View file @
1f99b730
password
:
method
:
post
url
:
/api/accounts/login/password
params
:
current_city_id
:
${current_city_id}
data
:
phone
:
${phone}
password
:
${password}
face_token
:
${face_token}
json
:
{}
in_common/base_request.py
View file @
1f99b730
...
...
@@ -70,11 +70,12 @@ class BaseRequest:
# 接口请求的封装
def
api_send
(
self
,
req
:
dict
):
host
=
self
.
api_load
(
path_setting
.
HOSTYAML_CONFIG
)
raw
=
yaml
.
dump
(
req
)
# 将一个python对象生成为yaml文档
for
key
,
value
in
self
.
params
.
items
():
raw
=
raw
.
replace
(
f
"${{{key}}}"
,
repr
(
value
))
req
=
yaml
.
safe_load
(
raw
)
print
(
'req:'
,
req
)
# print('------', req.get('headers'))
# hd = req.get('headers')
# if hd == None:
...
...
path_setting.py
View file @
1f99b730
...
...
@@ -6,6 +6,7 @@ sys.path.append(BASE_DIR)
HOSTYAML_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto"
,
"host.yaml"
)
APYAML_CONFIG
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/all_backend_api"
,
"account_request.yaml"
)
LOGIN_VFC
=
os
.
path
.
join
(
BASE_DIR
,
"backend_auto/test_backend_data/account_data"
,
"login_vfc.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"
)
if
__name__
==
'__main__'
:
print
(
"=========="
,
HOSTYAML_CONFIG
)
test_backend_case/.DS_Store
0 → 100644
View file @
1f99b730
File added
test_backend_case/accounts_case/test_login_passwd.py
View file @
1f99b730
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import
pytest
from
ids_list
import
get_ids
import
path_setting
from
in_common.base_request
import
BaseRequest
from
all_backend_api.accounts_request
import
send_reqest
class
TestLoginPasswd
:
data
=
BaseRequest
()
.
api_load
(
path_setting
.
LOGIN_PASSWD
)
loginpasswd_case
,
loginpasswd_data
=
get_ids
(
data
,
"password"
)
@pytest.mark.parametrize
(
"param"
,
loginpasswd_data
,
ids
=
loginpasswd_case
)
def
test_login_passwd
(
self
,
param
):
print
(
param
[
"password"
])
r
=
send_reqest
()
.
login_passwd
(
param
[
"current_city_id"
],
param
[
"phone"
],
param
[
"password"
])
if
r
[
"error"
]
==
1
:
assert
r
[
"message"
]
==
param
[
"assert"
]
test_backend_data/accounts_data/login_passwd.yaml
View file @
1f99b730
password
:
#成功登录case
-
case
:
"
成功登录case--密码正常登录case"
current_city_id
:
"
beijing"
phone
:
"
17796839512"
password
:
123456
assert
:
"
17796839512"
#登录失败case
-
case
:
"
登录失败case--手机号错误"
current_city_id
:
"
beijing"
phone
:
"
17796839510"
password
:
123456
assert
:
"
手机号或密码不正确"
-
case
:
"
登录失败case--密码错误"
current_city_id
:
"
beijing"
phone
:
"
17796839512"
password
:
1234567
assert
:
"
手机号或密码不正确"
-
case
:
"
登录失败case--手机号格式非数字"
current_city_id
:
"
beijing"
phone
:
"
177968395qq"
password
:
123456
assert
:
"
该手机号未注册过更美,请先注册!"
-
case
:
"
登录失败case--手机号为空"
current_city_id
:
"
beijing"
phone
:
"
"
password
:
123456
assert
:
"
该手机号未注册过更美,请先注册!"
-
case
:
"
登录失败case--密码为空"
current_city_id
:
"
beijing"
phone
:
"
17796839512"
password
:
assert
:
"
手机号或密码不正确"
-
case
:
"
登录失败case--都为空"
current_city_id
:
"
beijing"
phone
:
password
:
assert
:
"
该手机号未注册过更美,请先注册!"
\ No newline at end of file
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