Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InterfaceAutoTest
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TestAuto
InterfaceAutoTest
Commits
026a20da
Commit
026a20da
authored
Jun 09, 2021
by
taoke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据库操作_调整成另一个数据库
parent
38c2a13f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
33 deletions
+90
-33
config.py
+2
-1
test_case/bmc/test_ ElectronicLicense.py
+3
-1
test_case/bmc/test_accountinfo.py
+7
-2
test_case/bmc/test_my.py
+52
-17
test_case/bmc/test_roadreview.py
+21
-11
test_case/bmc/test_vehicle_steward.py
+5
-1
No files found.
config.py
View file @
026a20da
...
...
@@ -26,7 +26,8 @@ class BaseConfig():
log_path
=
r''
# 日志路径
# 数据库
test_mysql
=
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
"edl_private"
)
test_mysql
=
(
"10.197.236.215"
,
3306
,
"root"
,
"DataCenter@!hik"
,
""
)
# test_mysql = ("10.197.236.190", 3306, "root", "123456", "")
class
BMCConfig
(
BaseConfig
):
...
...
test_case/bmc/test_ ElectronicLicense.py
View file @
026a20da
...
...
@@ -37,7 +37,9 @@ def get_vehickleId_Tounbind():
@pytest.fixture
(
scope
=
'function'
)
def
avatarUpdate_del
()
:
#修改头像清除
# mysql=BaseConfig.test_mysql
mysql
=
MYSQL
(
host
=
"10.197.236.190"
,
port
=
3306
,
user
=
"root"
,
pwd
=
"123456"
,
db
=
"edl_private"
)
# mysql = MYSQL(*mysql)
# mysql = MYSQL(host="10.197.236.190", port=3306, user="root", pwd="123456", db="edl_private")
mysql
=
MYSQL
(
"10.197.236.215"
,
3306
,
"root"
,
"DataCenter@!hik"
,
"edl_public"
)
mysql
.
ExecuNonQuery
(
"DELETE FROM edl_private.driving_license_image_audit WHERE name='自动化';"
)
# 删除驾驶员
...
...
test_case/bmc/test_accountinfo.py
View file @
026a20da
...
...
@@ -11,7 +11,7 @@ from common.db import MYSQL, RedisString
from
common.utils.getExcelData
import
get_excelData
from
service.login
import
BMY
from
common.tools
import
request_main
from
config
import
BMCConfig
from
config
import
BMCConfig
,
BaseConfig
@allure.feature
(
"账号信息基本功能"
)
...
...
@@ -54,7 +54,12 @@ class TestRegister():
def
setup_class
(
self
):
# def test_mysql_result(self):
"""数据库操作"""
self
.
ms
=
MYSQL
(
'10.197.236.190'
,
3306
,
'root'
,
'123456'
,
'edl_public'
)
# self.ms = MYSQL('10.197.236.190', 3306, 'root', '123456', 'edl_public')
self
.
ms
=
MYSQL
(
"10.197.236.215"
,
3306
,
"root"
,
"DataCenter@!hik"
,
"edl_public"
)
# mysql = BaseConfig.test_mysql
# self.ms = MYSQL(*mysql)
@allure.story
(
"获取用户登录类型"
)
@allure.link
(
"http://yapi.hikcreate.com/project/31/interface/api/10745"
)
...
...
test_case/bmc/test_my.py
View file @
026a20da
This diff is collapsed.
Click to expand it.
test_case/bmc/test_roadreview.py
View file @
026a20da
...
...
@@ -12,6 +12,7 @@ from common.db import MYSQL
from
common.tools
import
request_main
from
common.utils
import
getExcelData
from
service.login
import
BMC
from
config
import
BaseConfig
...
...
@@ -25,7 +26,10 @@ class TestRoadreview:
config
.
BMCConfig
.
headers
[
"bmc_token"
]
=
res
[
0
]
config
.
BMCConfig
.
headers
[
"bmc_pvt_token"
]
=
res
[
1
]
self
.
headers
=
config
.
BMCConfig
.
headers
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"edl_private"
)
# mysql=MYSQL("10.197.236.190", 3306, "root", "123456", db="edl_private")
# mysql = BaseConfig.test_mysql
# mysql = MYSQL(*mysql)
mysql
=
MYSQL
(
"10.197.236.215"
,
3306
,
"root"
,
"DataCenter@!hik"
,
db
=
"edl_public"
)
self
.
pvt_user_id
=
mysql
.
ExecuQuery
(
"SELECT id FROM user WHERE phone='17822000000';"
)[
0
][
"id"
]
#不同账号登录,将sql中的user_id修改为获取到的用户专网id:self.pvt_user_id
...
...
@@ -100,7 +104,10 @@ class TestRoadreview:
data
=
{
"isHasNotFinish"
:
0
,
"peoplePhone"
:
"18800000044"
,
"companyName"
:
"666"
,
"organizeCode"
:
"168685858588855850"
,
"peopleName"
:
"接口自动化"
,
"id"
:
'null'
}
method
=
'post'
res
=
request_main
(
url
,
self
.
headers
,
method
,
data
)
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"db_gy_dmsmp"
)
# mysql = MYSQL("10.197.236.190", 3306, "root", "123456", db="db_gy_dmsmp")
# mysql = BaseConfig.test_mysql
# mysql = MYSQL(*mysql)
mysql
=
MYSQL
(
"10.197.236.215"
,
3306
,
"root"
,
"DataCenter@!hik"
,
db
=
"db_gy_dmsmp"
)
basic_info_id
=
mysql
.
ExecuQuery
(
"select id from db_gy_dmsmp.occupy_road_apply where user_id=393038 and people_phone='18800000044'order by id;"
)[
-
1
][
"id"
]
return
basic_info_id
...
...
@@ -236,7 +243,10 @@ class TestRoadreview:
def
teardown_class
(
self
):
mysql
=
MYSQL
(
"10.197.236.190"
,
3306
,
"root"
,
"123456"
,
db
=
"db_gy_dmsmp"
)
# mysql = MYSQL("10.197.236.190", 3306, "root", "123456", db="db_gy_dmsmp")
# mysql = BaseConfig.test_mysql
# mysql = MYSQL(*mysql)
mysql
=
MYSQL
(
"10.197.236.215"
,
3306
,
"root"
,
"DataCenter@!hik"
,
db
=
"db_gy_dmsmp"
)
mysql
.
ExecuNonQuery
(
"delete from db_gy_dmsmp.occupy_road_apply where user_id='393038' and people_phone='18800000044' ;"
)
def
teardown
(
self
):
...
...
@@ -247,10 +257,10 @@ class TestRoadreview:
# if __name__ == '__main__':
#
# # 生成报告数据
# pytest.main(['-v', '-s', "test_roadreview.py", '--alluredir', './bmc/report',"--clean-alluredir"])
# # pytest.main(['-v', '-s', "test_roadreview.py::TestRoadreview::test_roaddetail", '--alluredir', './bmc/report', "--clean-alluredir"])
# # 打开报告
# os.system('allure serve ./bmc/report')
\ No newline at end of file
if
__name__
==
'__main__'
:
# 生成报告数据
pytest
.
main
([
'-v'
,
'-s'
,
"test_roadreview.py"
,
'--alluredir'
,
'./bmc/report'
,
"--clean-alluredir"
])
# pytest.main(['-v', '-s', "test_roadreview.py::TestRoadreview::test_roaddetail", '--alluredir', './bmc/report', "--clean-alluredir"])
# 打开报告
os
.
system
(
'allure serve ./bmc/report'
)
\ No newline at end of file
test_case/bmc/test_vehicle_steward.py
View file @
026a20da
...
...
@@ -17,7 +17,11 @@ class TestVehicleSteward():
# def test_setup_class(self):
"""链接数据库"""
# 出行服务
self
.
ms
=
MYSQL
(
'10.197.236.190'
,
3306
,
'root'
,
'123456'
,
'edl_public'
)
# self.ms = MYSQL('10.197.236.190', 3306, 'root', '123456', 'edl_public')
self
.
ms
=
MYSQL
(
"10.197.236.215"
,
3306
,
"root"
,
"DataCenter@!hik"
,
"edl_public"
)
# mysql = BaseConfig.test_mysql
# self.ms = MYSQL(*mysql)
# 获取账号的userId -- 目前已经在excel中写死为 17822000000 账号的userId
resList
=
self
.
ms
.
ExecuQuery
(
'SELECT * FROM edl_public.user where phone=17822000000;'
)
self
.
user_id
=
resList
[
0
][
'id'
]
...
...
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