Commit bb8c292b authored by libin's avatar libin
Browse files

修改初始数据SQL

parent b16404e3
......@@ -9,82 +9,83 @@ def init():
select_domain_sql = "SELECT id,domainUrl FROM domain WHERE domainName='%s';"%(test_data.COMPANY_NAME)
sql_obj.executeSQL(select_domain_sql)
test_data.COMPANY_ID = sql_obj.result[0][0]
test_data.COMPANY_URL = sql_obj.result[0][1]
# print(test_data.COMPANY_ID,test_data.COMPANY_URL)
test_data.COMPANY_ID = str(sql_obj.result[0][0])
test_data.COMPANY_URL = str(sql_obj.result[0][1])
test_data.COMPANYADMIN_NAME = "admin@" + test_data.COMPANY_URL
print(test_data.COMPANY_ID,test_data.COMPANY_URL)
#园区
select_park_sql = "SELECT id,parkName,amTime,pmTime FROM park WHERE domainId=%s"%(test_data.COMPANY_ID)
sql_obj.executeSQL(select_park_sql)
test_data.PRE_PARK_ID = sql_obj.result[0][0]
test_data.PRE_PARK_NAME = sql_obj.result[0][1]
test_data.PRE_MORNING_START_TIME = sql_obj.result[0][2][:5]
test_data.PRE_MORNING_END_TIME = sql_obj.result[0][2][6:]
test_data.PRE_AFTERNOON_START_TIME = sql_obj.result[0][3][:5]
test_data.PRE_AFTERNOON_END_TIME = sql_obj.result[0][3][6:]
# print(test_data.PRE_PARK_ID,test_data.PRE_PARK_NAME,test_data.PRE_MORNING_START_TIME,test_data.PRE_MORNING_END_TIME,
# test_data.PRE_AFTERNOON_START_TIME,test_data.PRE_AFTERNOON_END_TIME)
test_data.PRE_PARK_ID = str(sql_obj.result[0][0])
test_data.PRE_PARK_NAME = str(sql_obj.result[0][1])
test_data.PRE_MORNING_START_TIME = str(sql_obj.result[0][2][:5])
test_data.PRE_MORNING_END_TIME = str(sql_obj.result[0][2][6:])
test_data.PRE_AFTERNOON_START_TIME = str(sql_obj.result[0][3][:5])
test_data.PRE_AFTERNOON_END_TIME = str(sql_obj.result[0][3][6:])
print(test_data.PRE_PARK_ID,test_data.PRE_PARK_NAME,test_data.PRE_MORNING_START_TIME,test_data.PRE_MORNING_END_TIME,
test_data.PRE_AFTERNOON_START_TIME,test_data.PRE_AFTERNOON_END_TIME)
#楼宇
select_build_sql = "SELECT id,buildingToken,officeBuildingName FROM officebuilding WHERE domainId=%s"%(test_data.COMPANY_ID)
sql_obj.executeSQL(select_build_sql)
test_data.PRE_BUILD_ID = sql_obj.result[0][0]
test_data.PRE_BUILD_BUILDTOKEN = sql_obj.result[0][1]
test_data.PRE_BUILD_NAME = sql_obj.result[0][2]
# print(test_data.PRE_BUILD_ID,test_data.PRE_BUILD_BUILDTOKEN,test_data.PRE_BUILD_NAME)
test_data.PRE_BUILD_ID = str(sql_obj.result[0][0])
test_data.PRE_BUILD_BUILDTOKEN = str(sql_obj.result[0][1])
test_data.PRE_BUILD_NAME = str(sql_obj.result[0][2])
print(test_data.PRE_BUILD_ID,test_data.PRE_BUILD_BUILDTOKEN,test_data.PRE_BUILD_NAME)
#楼层
select_floor_sql = "SELECT id,floorNum FROM floor WHERE domainId=%s"%(test_data.COMPANY_ID)
sql_obj.executeSQL(select_floor_sql)
test_data.PRE_FLOOR_ID = sql_obj.result[0][0]
test_data.PRE_FLOOR_NAME = sql_obj.result[0][1]
# print(test_data.PRE_FLOOR_ID,test_data.PRE_FLOOR_NAME)
test_data.PRE_FLOOR_ID = str(sql_obj.result[0][0])
test_data.PRE_FLOOR_NAME = str(sql_obj.result[0][1])
print(test_data.PRE_FLOOR_ID,test_data.PRE_FLOOR_NAME)
#区域
select_area_sql = "SELECT id,floorareaNum FROM floorarea WHERE domainId=%s"%(test_data.COMPANY_ID)
sql_obj.executeSQL(select_area_sql)
test_data.PRE_AREA_ID = sql_obj.result[0][0]
test_data.PRE_AREA_NAME = sql_obj.result[0][1]
# print(test_data.PRE_AREA_ID,test_data.PRE_AREA_NAME)
test_data.PRE_AREA_ID = str(sql_obj.result[0][0])
test_data.PRE_AREA_NAME = str(sql_obj.result[0][1])
print(test_data.PRE_AREA_ID,test_data.PRE_AREA_NAME)
#部门
select_department_sql = "SELECT id,orgFatherId,orgName FROM organization WHERE domainId=%s AND orgName!='企业通讯录'"%(test_data.COMPANY_ID)
sql_obj.executeSQL(select_department_sql)
test_data.PRE_DEPARTMENT_ID = sql_obj.result[0][0]
test_data.PRE_DEPARTMENT_FATHER_ID = sql_obj.result[0][1]
test_data.PRE_DEPARTMENT_NAME = sql_obj.result[0][2]
test_data.PRE_DEPARTMENT_ID = str(sql_obj.result[0][0])
test_data.PRE_DEPARTMENT_FATHER_ID = str(sql_obj.result[0][1])
test_data.PRE_DEPARTMENT_NAME = str(sql_obj.result[0][2])
print(test_data.PRE_DEPARTMENT_ID,test_data.PRE_DEPARTMENT_FATHER_ID,test_data.PRE_DEPARTMENT_NAME)
#用户
select_user_sql = "SELECT id,employeeName,employeeId,attendanceCard,email FROM userinfo WHERE domainId=%s"%(test_data.COMPANY_ID)
select_user_sql = "SELECT id,employeeName,employeeId,attendanceCard,email FROM userinfo WHERE domainId=%s AND employeeName!='企业域管理员'"%(test_data.COMPANY_ID)
sql_obj.executeSQL(select_user_sql)
test_data.PRE_USER_ID = sql_obj.result[0][0]
test_data.PRE_USER_NAME = sql_obj.result[0][1]
test_data.PRE_USER_JOB_NUMBER = sql_obj.result[0][2]
test_data.PRE_USER_CARD_NUMBER = sql_obj.result[0][3]
test_data.PRE_USER_EMAIL = sql_obj.result[0][4]
# print(test_data.PRE_USER_ID,test_data.PRE_USER_NAME,test_data.PRE_USER_JOB_NUMBER,test_data.PRE_USER_CARD_NUMBER,test_data.PRE_USER_EMAIL)
test_data.PRE_USER_ID = str(sql_obj.result[0][0])
test_data.PRE_USER_NAME = str(sql_obj.result[0][1])
test_data.PRE_USER_JOB_NUMBER = str(sql_obj.result[0][2])
test_data.PRE_USER_CARD_NUMBER = str(sql_obj.result[0][3])
test_data.PRE_USER_EMAIL = str(sql_obj.result[0][4])
print(test_data.PRE_USER_ID,test_data.PRE_USER_NAME,test_data.PRE_USER_JOB_NUMBER,test_data.PRE_USER_CARD_NUMBER,test_data.PRE_USER_EMAIL)
#角色
select_common_role_sql = "SELECT id FROM role WHERE domainId=%s AND roleName='普通用户'"%(test_data.COMPANY_ID)
sql_obj.executeSQL(select_common_role_sql)
test_data.COMMON_USER_ROLE_ID = sql_obj.result[0][0]
test_data.COMMON_USER_ROLE_ID = str(sql_obj.result[0][0])
select_special_role_sql = "SELECT id FROM role WHERE domainId=%s AND roleName='特殊预约用户'" % (test_data.COMPANY_ID)
sql_obj.executeSQL(select_special_role_sql)
test_data.SPECIAL_USER_ROLE_ID = sql_obj.result[0][0]
# print(test_data.COMMON_USER_ROLE_ID,test_data.SPECIAL_USER_ROLE_ID)
test_data.SPECIAL_USER_ROLE_ID = str(sql_obj.result[0][0])
print(test_data.COMMON_USER_ROLE_ID,test_data.SPECIAL_USER_ROLE_ID)
#工位
selec_fix_station_sql = "SELECT id,stationNum FROM mobilestation WHERE domainId=%s AND stationType=2"%(test_data.COMPANY_ID)
sql_obj.executeSQL(selec_fix_station_sql)
test_data.PRE_FIXED_STATION_ID = sql_obj.result[0][0]
test_data.PRE_FIXED_STATION_NAME = sql_obj.result[0][1]
test_data.PRE_FIXED_STATION_ID = str(sql_obj.result[0][0])
test_data.PRE_FIXED_STATION_NAME = str(sql_obj.result[0][1])
selec_mobile_station_sql = "SELECT id,stationNum FROM mobilestation WHERE domainId=%s AND stationType=1" %(test_data.COMPANY_ID)
sql_obj.executeSQL(selec_mobile_station_sql)
test_data.PRE_MOBILE_STATION_ID = sql_obj.result[0][0]
test_data.PRE_MOBILE_STATION_NAME = sql_obj.result[0][1]
# print(test_data.PRE_FIXED_STATION_ID,test_data.PRE_FIXED_STATION_NAME,test_data.PRE_MOBILE_STATION_ID,
# test_data.PRE_MOBILE_STATION_NAME)
test_data.PRE_MOBILE_STATION_ID = str(sql_obj.result[0][0])
test_data.PRE_MOBILE_STATION_NAME = str(sql_obj.result[0][1])
print(test_data.PRE_FIXED_STATION_ID,test_data.PRE_FIXED_STATION_NAME,test_data.PRE_MOBILE_STATION_ID,
test_data.PRE_MOBILE_STATION_NAME)
sql_obj.close_connect()
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>智能工位系统测试报告</title>
<meta name="generator" content="HTMLTestRunner 0.8.2"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css" media="screen">
body { font-family: verdana, arial, helvetica, sans-serif; font-size: 80%; }
table { font-size: 100%; }
pre { }
/* -- heading ---------------------------------------------------------------------- */
h1 {
font-size: 16pt;
color: gray;
}
.heading {
margin-top: 0ex;
margin-bottom: 1ex;
}
.heading .attribute {
margin-top: 1ex;
margin-bottom: 0;
}
.heading .description {
margin-top: 4ex;
margin-bottom: 6ex;
}
/* -- css div popup ------------------------------------------------------------------------ */
a.popup_link {
}
a.popup_link:hover {
color: red;
}
.popup_window {
display: none;
position: relative;
left: 0px;
top: 0px;
/*border: solid #627173 1px; */
padding: 10px;
background-color: #E6E6D6;
font-family: "Lucida Console", "Courier New", Courier, monospace;
text-align: left;
font-size: 8pt;
width: 500px;
}
}
/* -- report ------------------------------------------------------------------------ */
#show_detail_line {
margin-top: 3ex;
margin-bottom: 1ex;
}
#result_table {
width: 80%;
border-collapse: collapse;
border: 1px solid #777;
}
#header_row {
font-weight: bold;
color: white;
background-color: #777;
}
#result_table td {
border: 1px solid #777;
padding: 2px;
}
#total_row { font-weight: bold; }
.passClass { background-color: #6c6; }
.failClass { background-color: #c60; }
.errorClass { background-color: #c00; }
.passCase { color: #6c6; }
.failCase { color: #c60; font-weight: bold; }
.errorCase { color: #c00; font-weight: bold; }
.hiddenRow { display: none; }
.testcase { margin-left: 2em; }
/* -- ending ---------------------------------------------------------------------- */
#ending {
}
</style>
</head>
<body>
<script language="javascript" type="text/javascript"><!--
output_list = Array();
/* level - 0:Summary; 1:Failed; 2:All */
function showCase(level) {
trs = document.getElementsByTagName("tr");
for (var i = 0; i < trs.length; i++) {
tr = trs[i];
id = tr.id;
if (id.substr(0,2) == 'ft') {
if (level < 1) {
tr.className = 'hiddenRow';
}
else {
tr.className = '';
}
}
if (id.substr(0,2) == 'pt') {
if (level > 1) {
tr.className = '';
}
else {
tr.className = 'hiddenRow';
}
}
}
}
function showClassDetail(cid, count) {
var id_list = Array(count);
var toHide = 1;
for (var i = 0; i < count; i++) {
tid0 = 't' + cid.substr(1) + '.' + (i+1);
tid = 'f' + tid0;
tr = document.getElementById(tid);
if (!tr) {
tid = 'p' + tid0;
tr = document.getElementById(tid);
}
id_list[i] = tid;
if (tr.className) {
toHide = 0;
}
}
for (var i = 0; i < count; i++) {
tid = id_list[i];
if (toHide) {
document.getElementById('div_'+tid).style.display = 'none'
document.getElementById(tid).className = 'hiddenRow';
}
else {
document.getElementById(tid).className = '';
}
}
}
function showTestDetail(div_id){
var details_div = document.getElementById(div_id)
var displayState = details_div.style.display
// alert(displayState)
if (displayState != 'block' ) {
displayState = 'block'
details_div.style.display = 'block'
}
else {
details_div.style.display = 'none'
}
}
function html_escape(s) {
s = s.replace(/&/g,'&amp;');
s = s.replace(/</g,'&lt;');
s = s.replace(/>/g,'&gt;');
return s;
}
/* obsoleted by detail in <div>
function showOutput(id, name) {
var w = window.open("", //url
name,
"resizable,scrollbars,status,width=800,height=450");
d = w.document;
d.write("<pre>");
d.write(html_escape(output_list[id]));
d.write("\n");
d.write("<a href='javascript:window.close()'>close</a>\n");
d.write("</pre>\n");
d.close();
}
*/
--></script>
<div class='heading'>
<h1>智能工位系统测试报告</h1>
<p class='attribute'><strong>Start Time:</strong> 2019-08-23 16:33:40</p>
<p class='attribute'><strong>Duration:</strong> 0:01:25.870448</p>
<p class='attribute'><strong>Status:</strong> Failure 4 Error 5</p>
<p class='description'>用例执行情况:</p>
</div>
<p id='show_detail_line'>Show
<a href='javascript:showCase(0)'>Summary</a>
<a href='javascript:showCase(1)'>Failed</a>
<a href='javascript:showCase(2)'>All</a>
</p>
<table id='result_table'>
<colgroup>
<col align='left' />
<col align='right' />
<col align='right' />
<col align='right' />
<col align='right' />
<col align='right' />
</colgroup>
<tr id='header_row'>
<td>Test Group/Test case</td>
<td>Count</td>
<td>Pass</td>
<td>Fail</td>
<td>Error</td>
<td>View</td>
</tr>
<tr class='errorClass'>
<td>testcase012_companyadmin_creat_build.Blulid</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td><a href="javascript:showClassDetail('c1',1)">Detail</a></td>
</tr>
<tr id='ft1.1' class='none'>
<td class='errorCase'><div class='testcase'>test_createbuild</div></td>
<td colspan='5' align='center'>
<!--css div popup start-->
<a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_ft1.1')" >
error</a>
<div id='div_ft1.1' class="popup_window">
<div style='text-align: right; color:red;cursor:pointer'>
<a onfocus='this.blur();' onclick="document.getElementById('div_ft1.1').style.display = 'none' " >
[x]</a>
</div>
<pre>
ft1.1: Traceback (most recent call last):
File "D:\workspace\python\Smart_workspace\src\testcase_for_test\testcase012_companyadmin_creat_build.py", line 15, in setUp
deal_db_data.clear_building()
File "D:\workspace\python\Smart_workspace\src\module\deal_db_data.py", line 42, in clear_building
sql = "DELETE FROM `officebuilding` WHERE domainID = " + test_data.COMPANY_ID + " AND id &lt;&gt; " +test_data.PRE_BUILD_ID
TypeError: can only concatenate str (not "int") to str
</pre>
</div>
<!--css div popup end-->
</td>
</tr>
<tr class='errorClass'>
<td>testcase034_companyadmin_delete_user.DeleteUser</td>
<td>8</td>
<td>0</td>
<td>4</td>
<td>4</td>
<td><a href="javascript:showClassDetail('c2',8)">Detail</a></td>
</tr>
<tr id='ft2.1' class='none'>
<td class='failCase'><div class='testcase'>test_delete_user_001: 删除单个没有绑定工位的用户(bug,提示信息:success)</div></td>
<td colspan='5' align='center'>
<!--css div popup start-->
<a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_ft2.1')" >
fail</a>
<div id='div_ft2.1' class="popup_window">
<div style='text-align: right; color:red;cursor:pointer'>
<a onfocus='this.blur();' onclick="document.getElementById('div_ft2.1').style.display = 'none' " >
[x]</a>
</div>
<pre>
ft2.1: Traceback (most recent call last):
File "D:\workspace\python\Smart_workspace\src\common\web_client.py", line 238, in assert_mark_msg
assert msg in txtmsg
AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\workspace\python\Smart_workspace\src\testcase_for_test\testcase034_companyadmin_delete_user.py", line 57, in test_delete_user_001
self.browser.assert_mark_msg(xtpz_yhxx.SEARCH_RESULT_TEXT, test_data.SEARCH_RESULT_TEXT_13)
File "D:\workspace\python\Smart_workspace\src\common\web_client.py", line 241, in assert_mark_msg
"; expect restlt: " + msg)
AssertionError:
AssertError: actual result: 共 12 条; expect restlt: 共 13 条
</pre>
</div>
<!--css div popup end-->
</td>
</tr>
<tr id='ft2.2' class='none'>
<td class='errorCase'><div class='testcase'>test_delete_user_001: 删除单个没有绑定工位的用户(bug,提示信息:success)</div></td>
<td colspan='5' align='center'>
<!--css div popup start-->
<a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_ft2.2')" >
error</a>
<div id='div_ft2.2' class="popup_window">
<div style='text-align: right; color:red;cursor:pointer'>
<a onfocus='this.blur();' onclick="document.getElementById('div_ft2.2').style.display = 'none' " >
[x]</a>
</div>
<pre>
ft2.2: Traceback (most recent call last):
File "D:\workspace\python\Smart_workspace\src\testcase_for_test\testcase034_companyadmin_delete_user.py", line 157, in tearDown
deal_db_data.clear_station()
File "D:\workspace\python\Smart_workspace\src\module\deal_db_data.py", line 91, in clear_station
clear_reservation()
File "D:\workspace\python\Smart_workspace\src\module\deal_db_data.py", line 97, in clear_reservation
delete_sql = "DELETE FROM `reservation` WHERE domainId=" + test_data.COMPANY_ID
TypeError: can only concatenate str (not "int") to str
</pre>
</div>
<!--css div popup end-->
</td>
</tr>
<tr id='ft2.3' class='none'>
<td class='failCase'><div class='testcase'>test_delete_user_002: 删除单个绑定了工位的用户(bug,提示信息:success)</div></td>
<td colspan='5' align='center'>
<!--css div popup start-->
<a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_ft2.3')" >
fail</a>
<div id='div_ft2.3' class="popup_window">
<div style='text-align: right; color:red;cursor:pointer'>
<a onfocus='this.blur();' onclick="document.getElementById('div_ft2.3').style.display = 'none' " >
[x]</a>
</div>
<pre>
ft2.3: Traceback (most recent call last):
File "D:\workspace\python\Smart_workspace\src\common\web_client.py", line 238, in assert_mark_msg
assert msg in txtmsg
AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\workspace\python\Smart_workspace\src\testcase_for_test\testcase034_companyadmin_delete_user.py", line 85, in test_delete_user_002
self.browser.assert_mark_msg(xtpz_yhxx.SEARCH_RESULT_TEXT ,test_data.SEARCH_RESULT_TEXT_13)
File "D:\workspace\python\Smart_workspace\src\common\web_client.py", line 241, in assert_mark_msg
"; expect restlt: " + msg)
AssertionError:
AssertError: actual result: 共 12 条; expect restlt: 共 13 条
</pre>
</div>
<!--css div popup end-->
</td>
</tr>
<tr id='ft2.4' class='none'>
<td class='errorCase'><div class='testcase'>test_delete_user_002: 删除单个绑定了工位的用户(bug,提示信息:success)</div></td>
<td colspan='5' align='center'>
<!--css div popup start-->
<a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_ft2.4')" >
error</a>
<div id='div_ft2.4' class="popup_window">
<div style='text-align: right; color:red;cursor:pointer'>
<a onfocus='this.blur();' onclick="document.getElementById('div_ft2.4').style.display = 'none' " >
[x]</a>
</div>
<pre>
ft2.4: Traceback (most recent call last):
File "D:\workspace\python\Smart_workspace\src\testcase_for_test\testcase034_companyadmin_delete_user.py", line 157, in tearDown
deal_db_data.clear_station()
File "D:\workspace\python\Smart_workspace\src\module\deal_db_data.py", line 91, in clear_station
clear_reservation()
File "D:\workspace\python\Smart_workspace\src\module\deal_db_data.py", line 97, in clear_reservation
delete_sql = "DELETE FROM `reservation` WHERE domainId=" + test_data.COMPANY_ID
TypeError: can only concatenate str (not "int") to str
</pre>
</div>
<!--css div popup end-->
</td>
</tr>
<tr id='ft2.5' class='none'>
<td class='failCase'><div class='testcase'>test_delete_user_003: 批量删除没有绑定工位的用户(bug,提示信息:success)</div></td>
<td colspan='5' align='center'>
<!--css div popup start-->
<a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_ft2.5')" >
fail</a>
<div id='div_ft2.5' class="popup_window">
<div style='text-align: right; color:red;cursor:pointer'>
<a onfocus='this.blur();' onclick="document.getElementById('div_ft2.5').style.display = 'none' " >
[x]</a>
</div>
<pre>
ft2.5: Traceback (most recent call last):
File "D:\workspace\python\Smart_workspace\src\common\web_client.py", line 238, in assert_mark_msg
assert msg in txtmsg
AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\workspace\python\Smart_workspace\src\testcase_for_test\testcase034_companyadmin_delete_user.py", line 103, in test_delete_user_003
self.browser.assert_mark_msg(xtpz_yhxx.SEARCH_RESULT_TEXT, test_data.SEARCH_RESULT_TEXT_13)
File "D:\workspace\python\Smart_workspace\src\common\web_client.py", line 241, in assert_mark_msg
"; expect restlt: " + msg)
AssertionError:
AssertError: actual result: 共 12 条; expect restlt: 共 13 条
</pre>
</div>
<!--css div popup end-->
</td>
</tr>
<tr id='ft2.6' class='none'>
<td class='errorCase'><div class='testcase'>test_delete_user_003: 批量删除没有绑定工位的用户(bug,提示信息:success)</div></td>
<td colspan='5' align='center'>
<!--css div popup start-->
<a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_ft2.6')" >
error</a>
<div id='div_ft2.6' class="popup_window">
<div style='text-align: right; color:red;cursor:pointer'>
<a onfocus='this.blur();' onclick="document.getElementById('div_ft2.6').style.display = 'none' " >
[x]</a>
</div>
<pre>
ft2.6: Traceback (most recent call last):