Ejemplo n.º 1
0
 def order_status(self):
     db_PartnerOrderNO = MySql.db_Query(self,
                                        dict_load['mysql']['查询新订单号db'],
                                        dict_load['mysql']['查询新订单号sql'])
     c_OrderNO = table.read(self, 4)
     assert db_PartnerOrderNO[0] == c_OrderNO
     # 5>>
     table.write(self, 5, '待发货')
Ejemplo n.º 2
0
 def get_JD_values(self):
     AccessToken = MySql.db_Query(self, dict_load['mysql']['京东预存款db'],
                                  dict_load['mysql']['查询京东AccessToken'])
     url = dict_load['url']['京东预付款URL']
     date = {'token': AccessToken}
     respones = requests.post(url, date)
     AdvanceDeposit = re.findall(r'"result":"(.+?)"', str(respones.text))
     value = AdvanceDeposit[0]
     return value
Ejemplo n.º 3
0
 def environmentPrepar(self):
     mobile_emulation = {'deviceName': 'iPhone 5'}
     options = webdriver.ChromeOptions()
     options.add_experimental_option("mobileEmulation", mobile_emulation)
     self.driver = webdriver.Chrome(executable_path='chromedriver.exe',
                                    chrome_options=options)
     self.driver.implicitly_wait(15)
     self.driver.maximize_window()
     self.driver.get(dict_load['url']['C端URL'])
     sleep(1)
     loc = (By.CSS_SELECTOR, dict_load['C端页面元素']['用户积分'])
     WebDriverWait(self.driver, 10).until(
         expected_conditions.visibility_of_element_located(loc))
     u1 = means.get_text(self, 'css', dict_load['C端页面元素']['用户积分'])
     u2 = re.findall(r"(......+?)", str(u1))
     u3 = str(u2).replace(',', '')
     # C端用户下单前用户积分
     u4 = u3[2:-2]
     # 0>>>
     table.cretaTable(self)
     table.write(self, 0, u4)
     sleep(4)
     if int(u4) <= 4000:
         print('用户积分不足,请充值积分!')
     elif int(u4) > 4000:
         print('积分充足!准备执行用例......')
     else:
         print('用户积分为0,请检查环境!')
     # 数据库初始化
     self.db = pymysql.connect(
         host=dict_load['mysql']['host'],
         user=dict_load['mysql']['user'],
         password=dict_load['mysql']['pwd'],
     )
     try:
         self.db
         print('数据库连接成功!准备执行用例......')
     except:
         print('数据库连接失败!请检查!')
     self.cursor = self.db.cursor()
     self.cursor.execute('SHOW DATABASES')
     c = MySql.db_Query(self, dict_load['mysql']['商家菜籽db'],
                        dict_load['mysql']['查询商家菜籽sql'])
     c1 = re.findall(r"[(]'(.......+?).", str(c))
     if int(c1[0]) <= 1000000:
         MySql.db_NotQuery(self, dict_load['mysql']['商家菜籽db'],
                           dict_load['mysql']['加菜籽sql'])
         print('菜籽充足!准备执行用例......')
     else:
         print('菜籽充足!准备执行用例......')
Ejemplo n.º 4
0
 def get_caizi_values(self):
     c = MySql.db_Query(self, dict_load['mysql']['商家菜籽db'],
                        dict_load['mysql']['查询商家菜籽sql'])
     c1 = re.findall(r"[(]'(.......+?).", str(c))
     return c1[0]
Ejemplo n.º 5
0
 def get_NewOrderNumber_On_db(self):
     db_PartnerOrderNO = MySql.db_Query(self,
                                        dict_load['mysql']['查询新订单号db'],
                                        dict_load['mysql']['查询新订单号sql'])
     db_odd_numbers = re.findall(r"'(.+?)'", str(db_PartnerOrderNO))
     return db_odd_numbers[0]
Ejemplo n.º 6
0
 def get_countOrder_values(self):
     a = MySql.db_Query(self, dict_load['mysql']['商家菜籽db'],
                        dict_load['mysql']['查询用户订单总数sql'])
     a1 = re.findall(r"[(][(](.+?),", str(a))
     return a1[0]