# -*- coding: utf-8 -*- """票 12 seed 终态断言:a2 工作计划恰 3 行(e2e-wp- 前缀,状态 0/0/1,仅已完成行有 finish_time)。""" import io import sys import pymysql sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') conn = pymysql.connect(host='8.129.84.155', port=3306, user='root', password='Itc@123456', database='crm', charset='utf8mb4', autocommit=True) try: cur = conn.cursor() cur.execute("SELECT id FROM opportunity WHERE opp_name LIKE 'e2e-A-推进-智慧园区二期%' AND deleted=0") a2 = cur.fetchone()[0] cur.execute( 'SELECT plan_content, plan_status, finish_time, delete_key, deleted ' 'FROM opportunity_work_plan WHERE opp_id=%s ORDER BY create_time', (a2,)) rows = cur.fetchall() print(f'a2={a2} 工作计划 {len(rows)} 行:') ok = len(rows) == 3 for c, st, ft, dk, dl in rows: print(f' [{c}] status={st} finish_time={ft} delete_key={dk} deleted={dl}') if not str(c).startswith('e2e-wp-') or dk != 0 or dl != 0: ok = False if '已完成' in c and (st != 1 or ft is None): ok = False if '已完成' not in c and (st != 0 or ft is not None): ok = False print('终态断言:' + ('✅ 通过' if ok else '❌ 不符')) sys.exit(0 if ok else 1) finally: conn.close()