def test46_joinbuy_lead_sort(self): """46 (封闭式排序)股神出资""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy02_fbi( ) po.joinbuy23_lead_amount( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select lead_invest_amount from base_project where trade_id=" + trade_id lead1 = getdata(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select lead_invest_amount from base_project where trade_id=" + trade_id lead2 = getdata(sql) self.assertTrue(lead1 >= lead2, msg="按股神出资排序错误") po.joinbuy23_lead_amount( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select lead_invest_amount from base_project where trade_id=" + trade_id lead1 = getdata(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select lead_invest_amount from base_project where trade_id=" + trade_id lead2 = getdata(sql) self.assertTrue(lead1 <= lead2, msg="按股神出资排序错误")
def test44_joinbuy_commission_sort(self): """44 (封闭式排序)佣金""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy02_fbi( ) po.joinbuy21_commission( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select commission from base_project WHERE trade_id=" + trade_id commission1 = getdata(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select commission from base_project WHERE trade_id=" + trade_id commission2 = getdata(sql) self.assertTrue(commission1 >= commission2, msg="按佣金排序错误") po.joinbuy21_commission( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select commission from base_project WHERE trade_id=" + trade_id commission1 = getdata(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select commission from base_project WHERE trade_id=" + trade_id commission2 = getdata(sql) self.assertTrue(commission1 <= commission2, msg="按佣金排序错误")
def test35_joinbuy_projetcamount_sort(self): """35 (开放式排序)总金额""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy22_projetcamount( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql1 = "select applied_amount from dynamic_project WHERE trade_id=" + trade_id sql2 = "select market_value from opening_project WHERE trade_id=" + trade_id applied = getdata(sql1) market = getdata(sql2) if getdata(sql1) is None: applied = 0 if getdata(sql2) is None: market = 0 projetcamount1 = applied + market trade_id = po.get_id(elements[i]) i += 1 sql1 = "select applied_amount from dynamic_project WHERE trade_id=" + trade_id sql2 = "select market_value from opening_project WHERE trade_id=" + trade_id applied = getdata(sql1) market = getdata(sql2) if getdata(sql1) is None: applied = 0 if getdata(sql2) is None: market = 0 projetcamount2 = applied + market self.assertTrue(projetcamount1 >= projetcamount2, msg="总金额排序无效") po.joinbuy22_projetcamount( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql1 = "select applied_amount from dynamic_project WHERE trade_id=" + trade_id sql2 = "select market_value from opening_project WHERE trade_id=" + trade_id applied = getdata(sql1) market = getdata(sql2) if getdata(sql1) is None: applied = 0 if getdata(sql2) is None: market = 0 projetcamount1 = applied + market trade_id = po.get_id(elements[i]) i += 1 sql1 = "select applied_amount from dynamic_project WHERE trade_id=" + trade_id sql2 = "select market_value from opening_project WHERE trade_id=" + trade_id applied = getdata(sql1) market = getdata(sql2) if getdata(sql1) is None: applied = 0 if getdata(sql2) is None: market = 0 projetcamount2 = applied + market self.assertTrue(projetcamount1 <= projetcamount2, msg="总金额排序无效")
def test43_joinbuy_closure_sort(self): """43 (封闭式排序)交易周期""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy02_fbi( ) po.joinbuy20_stage_closure( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select period from base_project WHERE trade_id=" + trade_id period1 = getdata(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select period from base_project WHERE trade_id=" + trade_id period2 = getdata(sql) self.assertTrue(period1 >= period2, msg="按交易周期排序错误") po.joinbuy20_stage_closure( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select period from base_project WHERE trade_id=" + trade_id period1 = getdata(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select period from base_project WHERE trade_id=" + trade_id period2 = getdata(sql) self.assertTrue(period1 <= period2, msg="按交易周期排序错误")
def test37_joinbuy_amountnum_sort(self): """37 (开放式排序)投资笔数""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy24_amount_num( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select * from open_invest_apply WHERE state!='discard' and trade_id=" + trade_id amountnum1 = getnum(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select * from open_invest_apply WHERE state!='discard' and trade_id=" + trade_id amountnum2 = getnum(sql) self.assertTrue(amountnum1 >= amountnum2, msg="投资笔数排序错误") po.joinbuy24_amount_num( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select * from open_invest_apply WHERE state!='discard' and trade_id=" + trade_id amountnum1 = getnum(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select * from open_invest_apply WHERE state!='discard' and trade_id=" + trade_id amountnum2 = getnum(sql) self.assertTrue(amountnum1 <= amountnum2, msg="投资笔数排序错误")
def test33_joinbuy_closure_sort(self): """33 (开放式排序)交易周期""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy20_stage_closure( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select stage_closure from opening_project WHERE trade_id=" + trade_id closure1 = getdata(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select stage_closure from opening_project WHERE trade_id=" + trade_id closure2 = getdata(sql) self.assertTrue(closure1 >= closure2, msg="按交易周期排序无效") po.joinbuy20_stage_closure( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select stage_closure from opening_project WHERE trade_id=" + trade_id closure1 = getdata(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select stage_closure from opening_project WHERE trade_id=" + trade_id closure2 = getdata(sql) self.assertTrue(closure1 <= closure2, msg="按交易周期排序无效")
def test45_joinbuy_projetcamount_sort(self): """45 (封闭式排序)总金额""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy02_fbi( ) po.joinbuy22_projetcamount( ) elements1 = po.joinbuy55_productlist_name( ) elements2 = po.find_elements(By.XPATH, "//div[@class='root-listxq']/a") num = len(elements1) i = 0 while (i + 1) < num: trade_id = po.get_id(elements1[i]) stage = elements2[i].text if stage in "投资中/审核中": sql = "select trade_amount from base_project WHERE trade_id=" + trade_id else: sql = "select loaned_amount from dynamic_project WHERE trade_id=" + trade_id projetcamount1 = getdata(sql) i += 1 trade_id = po.get_id(elements1[i]) stage = elements2[i].text if stage in "投资中/审核中": sql = "select trade_amount from base_project WHERE trade_id=" + trade_id else: sql = "select loaned_amount from dynamic_project WHERE trade_id=" + trade_id projetcamount2 = getdata(sql) self.assertTrue(projetcamount1 >= projetcamount2, msg="总金额排序错误") po.joinbuy22_projetcamount( ) elements1 = po.joinbuy55_productlist_name( ) elements2 = po.find_elements(By.XPATH, "//div[@class='root-listxq']/a") num = len(elements1) i = 0 while (i + 1) < num: trade_id = po.get_id(elements1[i]) stage = elements2[i].text if stage in "投资中/审核中": sql = "select trade_amount from base_project WHERE trade_id=" + trade_id else: sql = "select loaned_amount from dynamic_project WHERE trade_id=" + trade_id projetcamount1 = getdata(sql) i += 1 trade_id = po.get_id(elements1[i]) stage = elements2[i].text if stage in "投资中/审核中": sql = "select trade_amount from base_project WHERE trade_id=" + trade_id else: sql = "select loaned_amount from dynamic_project WHERE trade_id=" + trade_id projetcamount2 = getdata(sql) self.assertTrue(projetcamount1 <= projetcamount2, msg="总金额排序错误")
def test42_joinbuy_godlevel_sort(self): """42 (封闭式排序)股神评级""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy02_fbi( ) po.joinbuy19_certify_level( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select user_name from base_project where trade_id=" + trade_id user_name = getdata(sql) sql = "select user_id from user_base_info where user_name=" + '"' + user_name + '"' user_id = str(getdata(sql)) sql = "select certify_level from god where user_id=" + user_id god_level1 = getdata(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select user_name from base_project where trade_id=" + trade_id user_name = getdata(sql) sql = "select user_id from user_base_info where user_name=" + '"' + user_name + '"' user_id = str(getdata(sql)) sql = "select certify_level from god where user_id=" + user_id god_level2 = getdata(sql) self.assertTrue(god_level1 >= god_level2, msg="按股神评级排序无效") po.joinbuy19_certify_level( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select user_name from base_project where trade_id=" + trade_id user_name = getdata(sql) sql = "select user_id from user_base_info where user_name=" + '"' + user_name + '"' user_id = str(getdata(sql)) sql = "select certify_level from god where user_id=" + user_id god_level1 = getdata(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select user_name from base_project where trade_id=" + trade_id user_name = getdata(sql) sql = "select user_id from user_base_info where user_name=" + '"' + user_name + '"' user_id = str(getdata(sql)) sql = "select certify_level from god where user_id=" + user_id god_level2 = getdata(sql) self.assertTrue(god_level1 <= god_level2, msg="按股神评级排序无效")
def test28_joinbuy_profit_sort(self): """28 (开放式排序)总收益""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy14_profit( ) po.joinbuy15_projectprofit( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i]) sql = "select float_profit_rate from dynamic_project where trade_id=" + trade_id profit1 = getdata(sql) i += 1 trade_id = po.get_id(elements[i]) sql = "select float_profit_rate from dynamic_project where trade_id=" + trade_id profit2 = getdata(sql) self.assertTrue(profit1 >= profit2, msg="总收益排序无效")
def test29_joinbuy_d30profit_sort(self): """29 (开放式排序)近30天收益""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy14_profit( ) po.joinbuy16_d30profit( ) elements = po.joinbuy55_productlist_name( ) num = len(elements) i = 0 while (i + 1) < num: trade_id = po.get_id(elements[i])
def test27_joinbuy_futures(self): """27 (封闭)期货""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy02_fbi( ) po.joinbuy13_product_futures( ) if po.joinbuy26_isnone( ): elements = po.joinbuy55_productlist_name( ) # 取出元素列表循环列表比较各个投资类型 for i in elements: trade_id = po.get_id(i) sql = "select product_type from base_project WHERE trade_id=" + trade_id product_type = getdata(sql) self.assertEqual(product_type, "futures", msg="股票筛选按钮无效") else: print("该项目列表为空")
def test26_joinbuy_shares(self): """26 (封闭)股票""" po = JoinBuy(self.driver) po.open( ) sleep(2) po.joinbuy02_fbi( ) po.joinbuy12_product_shares( ) if po.joinbuy26_isnone( ): elements = po.joinbuy55_productlist_name( ) for i in elements: trade_id = po.get_id(i) sql = "select product_type from base_project WHERE trade_id=" + trade_id product_type = getdata(sql) self.assertEqual(product_type, "stock", msg="股票筛选按钮无效") else: print("该项目列表为空")