This commit is contained in:
晴月 2025-04-15 09:22:27 +08:00
parent 72dd4770eb
commit cb2009958f
8 changed files with 25 additions and 15 deletions

View File

@ -1,6 +1,6 @@
CREATE DATABASE TESTDB;
USE TESTDB;
CREATE TABLE EMPLOYEE (
CREATE TABLE IF NOT EXISTS EMPLOYEE (
FIRST_NAME CHAR(20) NOT NULL,
LAST_NAME CHAR(20),
AGE INT,

View File

@ -1,6 +1,6 @@
import pymysql
db=pymysql.connect (
host='localhost',
host='172.16.1.166',
user='root',
passwd='114514',
database='TESTDB',

View File

@ -1,13 +1,23 @@
import pymysql
db=pymysql.connect (
host='localhost',
user='root',
passwd='114514',
database='TESTDB',
)
db=pymysql.connect (host='172.16.1.166',user='root',passwd='114514',database='TESTDB',)
cursor=db.cursor()
cursor.execute('SHOW TABLES')
print(cursor.fetchall())
# 删表
cursor.execute('DROP TABLE IF EXISTS EMPLOYEE')
data=cursor.fetchone()
print(data)
cursor.execute('SHOW TABLES')
print(cursor.fetchall())
# 建表
cursor.execute("""
CREATE TABLE IF NOT EXISTS EMPLOYEE (
FIRST_NAME CHAR(20) NOT NULL,
LAST_NAME CHAR(20),
AGE INT,
SEX CHAR(1),
INCOME FLOAT
);
""")
cursor.execute('SHOW TABLES')
print(cursor.fetchall())
cursor.close()
db.close()

View File

@ -1,6 +1,6 @@
import pymysql
db=pymysql.connect (
host='localhost',
host='172.16.1.166',
user='root',
passwd='114514',
database='TESTDB',

View File

@ -1,6 +1,6 @@
import pymysql
db=pymysql.connect (
host='localhost',
host='172.16.1.166',
user='root',
passwd='114514',
database='TESTDB',

View File

@ -1,6 +1,6 @@
import pymysql
db=pymysql.connect (
host='localhost',
host='172.16.1.166',
user='root',
passwd='114514',
database='TESTDB',

View File

@ -12,5 +12,5 @@ class TestIhrmLogin(object):
assert rsp.status_code == ast[0]
assert rsp.json().get("success") == ast[1]
assert rsp.json().get("message") == ast[2]
if len(ast)==4:
if len(ast)>=4:
assert rsp.json().get("code") == ast[3]

View File

@ -15,7 +15,7 @@ class TestkdtxLogin(object):
login_res = requests.post(f'{BASE_URL}/login', json=login_data)
assert login_res.json()['msg'] == ast[0]
assert login_res.json()['code'] == ast[1]
if len(ast)==3:
if len(ast)>=3:
token, cookies = login_res.json()['token'], login_res.cookies.get_dict()
course_data = ast[2]
add_course_res = requests.post(f'{BASE_URL}/clues/course', json=course_data, headers={'Authorization': token},cookies=cookies)