Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm-zhuanzhen-test
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
刘丙寅
gm-zhuanzhen-test
Commits
b1c6061e
Commit
b1c6061e
authored
Aug 16, 2021
by
刘丙寅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增登录接口会话保持
parent
63f9c438
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
14 deletions
+55
-14
gm-zhuanzhen-test.iml
.idea/gm-zhuanzhen-test.iml
+1
-0
workspace.xml
.idea/workspace.xml
+0
-0
case_hera_celue_test.py
case/case_hera_celue_test.py
+4
-3
case_hera_customer_pool.py
case/case_hera_customer_pool.py
+3
-3
case_hera_modify.py
case/case_hera_modify.py
+3
-3
case_om_distribution_list.py
case/case_om_distribution_list.py
+7
-4
interface_method.py
interface/interface_method.py
+2
-1
login.py
interface/login.py
+35
-0
No files found.
.idea/gm-zhuanzhen-test.iml
View file @
b1c6061e
...
...
@@ -2,6 +2,7 @@
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$"
isTestSource=
"false"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/venv"
/>
</content>
<orderEntry
type=
"inheritedJdk"
/>
...
...
.idea/workspace.xml
View file @
b1c6061e
This diff is collapsed.
Click to expand it.
case/case_hera_celue_test.py
View file @
b1c6061e
...
...
@@ -4,12 +4,13 @@ import sys,os
sys
.
path
.
append
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))))
import
unittest
from
interface
import
interface
from
interface
import
interface
_method
from
requests.cookies
import
cookiejar_from_dict
from
pprint
import
pprint
from
ddt
import
ddt
,
data
import
jsonpath
import
yaml
from
interface.login
import
my_session
#获取上级目录路径
path
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
)))
...
...
@@ -35,9 +36,9 @@ class Case(unittest.TestCase):
print
(
"预期响应数据:开始"
)
pprint
(
contents
)
print
(
"预期响应数据:结束"
)
URL
=
interface
.
hera_host
+
interface
.
recommend_hospitals
URL
=
interface
_method
.
hera_host
+
interface_method
.
recommend_hospitals
body
=
contents
.
get
(
"request"
)
.
get
(
"body"
)
cookies
=
interface
.
hera_cookies
cookies
=
interface
_method
.
hera_cookies
result
=
requests
.
post
(
url
=
URL
,
cookies
=
cookiejar_from_dict
(
cookies
),
data
=
body
,
verify
=
False
)
res
=
result
.
json
()
...
...
case/case_hera_customer_pool.py
View file @
b1c6061e
import
requests
import
unittest
from
interface
import
interface
from
interface
import
interface
_method
from
ddt
import
ddt
,
data
import
os
from
pprint
import
pprint
...
...
@@ -32,11 +32,11 @@ class Case(unittest.TestCase):
# print("预期响应数据:开始")
# pprint(contents)
# print("预期响应数据:结束")
URL
=
interface
.
hera_host
+
interface
.
customer_pool_interface
URL
=
interface
_method
.
hera_host
+
interface_method
.
customer_pool_interface
body
=
contents
.
get
(
"request"
)
.
get
(
"body"
)
body
=
str
(
body
)
.
replace
(
'True'
,
"'true'"
)
.
replace
(
'False'
,
"'false'"
)
.
replace
(
'None'
,
"''"
)
print
(
body
)
cookies
=
interface
.
hera_cookies
cookies
=
interface
_method
.
hera_cookies
result
=
requests
.
post
(
url
=
URL
,
cookies
=
cookiejar_from_dict
(
cookies
),
data
=
eval
(
body
),
verify
=
False
)
res
=
result
.
json
()
print
(
"实际返回数据:开始"
)
...
...
case/case_hera_modify.py
View file @
b1c6061e
import
requests
import
unittest
from
interface
import
interface
from
interface
import
interface
_method
from
ddt
import
ddt
,
data
import
os
from
pprint
import
pprint
...
...
@@ -32,10 +32,10 @@ class Case(unittest.TestCase):
# print("预期响应数据:开始")
# pprint(contents)
# print("预期响应数据:结束")
URL
=
interface
.
hera_host
+
interface
.
modify
URL
=
interface
_method
.
hera_host
+
interface_method
.
modify
body
=
contents
.
get
(
"request"
)
.
get
(
"body"
)
print
(
body
)
cookies
=
interface
.
hera_cookies
cookies
=
interface
_method
.
hera_cookies
header
=
{
"content-type"
:
"text/html"
}
...
...
case/case_om_distribution_list.py
View file @
b1c6061e
...
...
@@ -4,13 +4,16 @@ import sys,os
sys
.
path
.
append
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))))
import
unittest
from
interface
import
interface
from
interface
import
interface_method
from
interface.login
import
my_session
from
requests.cookies
import
cookiejar_from_dict
from
pprint
import
pprint
from
ddt
import
ddt
,
data
import
jsonpath
import
yaml
#获取上级目录路径
path
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
)))
# 拼接需要的目录
...
...
@@ -30,10 +33,10 @@ class case(unittest.TestCase):
@data
(
*
file3
)
def
test_01_distribution_list
(
self
,
contents
):
'om后台客服客户池客户列表接口'
URL
=
interface
.
om_host
+
interface
.
om_distribution_list
URL
=
interface
_method
.
om_host
+
interface_method
.
om_distribution_list
body
=
contents
.
get
(
"request"
)
.
get
(
"body"
)
cookies
=
interface
.
om_cookies
result
=
requests
.
get
(
url
=
URL
,
cookies
=
cookies
,
params
=
body
,
verify
=
False
)
cookies
=
interface
_method
.
om_cookies
result
=
my_session
.
get
(
url
=
URL
,
params
=
body
)
res
=
result
.
json
()
print
(
"真实数据返回开始"
)
pprint
(
res
)
...
...
interface/interface.py
→
interface/interface
_method
.py
View file @
b1c6061e
...
...
@@ -19,7 +19,8 @@ modify = "/bdtransfer/modify/186363/?is_private=0"
# om后台客服客户池已分配客户列表接口
om_distribution_list
=
"/achelous/api/bdtransfer/consultant_list"
# 登录按钮
om_login
=
"/achelous/account/login"
interface/login.py
0 → 100644
View file @
b1c6061e
import
sys
,
os
print
(
sys
.
path
)
from
interface
import
interface_method
import
requests
sys
.
path
.
append
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))))
import
json
class
login
:
def
login_method
(
self
):
# 接口名称
URL
=
interface_method
.
om_host
+
interface_method
.
om_login
body
=
{
"username"
:
"yijiali"
,
"password"
:
"a1234567890"
}
my_session
=
requests
.
session
()
result
=
my_session
.
post
(
url
=
URL
,
data
=
body
,
verify
=
False
)
res
=
result
.
json
()
print
(
res
)
return
my_session
my_session
=
login
()
.
login_method
()
my_session
.
verify
=
False
print
(
my_session
.
cookies
)
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